2 ms·
JavaScript is a better, but JSX is not JavaScript. It reuses many features from JavaScript, but you still need some sort of translation (compilation) step to ma
by uranusjr 4y ago
JavaScript is a better, but JSX is not JavaScript. It reuses many features from JavaScript, but you still need some sort of translation (compilation) step to make it useful. In this sense it is not really fundamentally different from any of those what you call template languages.
You can argue the fact JSX better integrates syntaxes from a proper programming language makes it better than other templating languages (and I’m not going to try persuading you otherwise), but the “JSX is better than template language because it is not one” stance you’re implying won’t help you win any arguments.
- wokwokwok 4y agoIt is javascript. That is literally the difference between JSX and most other template languages. Look it up. The template syntax is converted to literally code and evaluated. The <> are just syntax sugar. How did you imagine the inline code works? The in-line function declarations? Did someone invent a mini-subset of JS as DSL and a custom runtime…? Don’t be ridiculous. They did not. JSX is literally a thin wrapper around actual code.
- uranusjr 4y agoTemplate language being translated to code is nothing new and certainly not unique to JSX even only when you consider frontend JavaScript frameworks. Vue has been doing that ever since single-file component was a thing. You need to look up things, please.