2 ms·
...but what does React.createElement compile down to? HTML and JS. Whether you do it with a clientside runtime or a serverside render, it still gets compiled or
by solardev 4y ago
...but what does React.createElement compile down to? HTML and JS. Whether you do it with a clientside runtime or a serverside render, it still gets compiled or transpiled down to DOM objects in the end.
I think of "pure JS" as something more like a standalone node function that takes an input and gives you some abstract data output, vs templating code whose main purpose is to define elements in the DOM.
That you can intersperse with JS with DOM-like props in a JSX component (styles, states, handlers, whatever) doesn't mean that JSX isn't a templating language. It's just one that also accepts inline JS. Hell, you can do that with PHP and heredocs/template literals.
Aren't all templating languages "syntactic sugar"? Isn't that their point?