DEV Community

Discussion on: Do We Need To Compile Website Components?

Collapse
 
rhymes profile image
rhymes

Hi Mainsara, I had a look at your library and I think the reason that brought you to create it is super valid, I feel like though the rationale that brought you to create the POC misses some info (at least with Vue and probably React, because they can both be used as UI rendering libraries, don't know about Angular).

In the project you state this:

Using components as building blocks for a website is great but having to use compiler to convert it into browser-ready code is something beginners have a hard time doing

If, understandably :), the goal is to simplify the adoption path without going down the rabbit hole of tools and compilers, there are already ways to do it (I'll speak about Vue because that's what I know).

Vue allows you to render itself right from the HTML page, without a build step. The documentation itself discourages beginners to start with the CLI tools but start with a simple page with the embeddable version of Vue.

By using Vue directly from the HTML page you have access to declarative rendering, looping and conditional controls and... components with templates.

You can go quite far then.

The CLI is suggested for large scale apps or SPAs, which make sense.

Your rx POC is cool! I see it contains a simple CSS parser, it uses mutation observer for the life cycles and so on. Basically a JS rendering library 🔥

Collapse
 
neutrino2211 profile image
Mainasara Al-amin Tsowa

Thanks and I agree, Vue runs perfectly well in a browser but react and angular are the "some assembly required" type of libraries, react is in this group because its method for making apps without jsx is not as easy as what Vue offers and in most cases it is easier to use the command-line than to try it without JSX

Collapse
 
sergiodxa profile image
Sergio Daniel Xalambrí

React could also totally run on browsers, the documentation also explain you how to do it

reactjs.org/docs/add-react-to-a-we...

Load the code from a CDN, create your component using React.createClass and render it, JSX is a nice add-on but is not required, and if the syntax of React.createClass is too verbose you could use htm to use a pseudo JSX syntax using template literals (the docs mentions Preact but it works with React too).