> It would be best to think of it as syntax sugar for create Element() function calls
Thats what makes it a new language. C is just sugar on top of assembly.
Its so strange that jsx needs a buildstep, but misses ton of obvious ergonomics that one could have added. Why className
instead of class? With a buildstep, it would surely be possible to determine if class was a keyword or not based on context
> Thats what makes it a new language. C is just sugar on top of assembly.
I think that's a bad example. C isn't a sugar for assembly: For example what assembly code does a function prototype desugar into? Sugars have 1:1 mappings with host code
Maybe you're just being rhetorical about the spectrum of macros, sugars, and languages, though.
(In my opinion, a better target for that criticism, in JS land, is the Jest test framework, because of all the reordering magic it does that break fundamental ES semantics)
> Why className instead of class?
This hasn't been a constraint since... I want to say React 18, six or seven years ago? I might be misremembering the history but I think that was only a problem in the Early Days when there was paranoia about whether JSX needed to be conservative with reserved keywords
Syntax sugar is language syntax that improves a common pattern from the language (making it sweater). jsx, async/await - things that just abstract common patterns.
Thats what makes it a new language. C is just sugar on top of assembly.
Its so strange that jsx needs a buildstep, but misses ton of obvious ergonomics that one could have added. Why className instead of class? With a buildstep, it would surely be possible to determine if class was a keyword or not based on context