3 ms·
I understand, and the browsers don't understand JSX is a fair point. I'm only illustrating that the difference between JSX and JS for React is about syntax and
by bern4444 5y ago
I understand, and the browsers don't understand JSX is a fair point.
I'm only illustrating that the difference between JSX and JS for React is about syntax and not the core distinction of why React feels easier to work with compared to angular/vue/svelte etc which all invent their own mini languages. JSX feels much more natural since it allows for the same JS everyone (hopefully) loves.
Something like hyperapp/hyperscript can absolutely be used in place of JSX, but the HTML likeness that JSX enables feels more natural to me - and I think most - vs a bunch of h1(), h2() etc function calls. In the end, though, this is a trivial difference.
A component expressed in JSX is really just a JS function call that ends up as a document.createElement() invocation.