3 ms·
It's actually a fairly small change (two new PrimaryExpressions), the spec is here: https://github.com/facebook/jsx https://github.com/facebook/jsx Example pa
by hunterb123 5y ago
It's actually a fairly small change (two new PrimaryExpressions), the spec is here:
https://github.com/facebook/jsx https://github.com/facebook/jsx
Example parser from Acorn:
https://github.com/acornjs/acorn-jsx/blob/master/index.js https://github.com/acornjs/acorn-jsx/blob/master/index.js
No part of JSX uses the DOM, it doesn't share anything with HTML.
The JS engine itself would need the modification.
Also JSX doesn't have to be for the UI, it could be for dialogs for an NPC in a game, for configs, etc.
edit: I agree with @proxyon, I'm really disappointed with HN that this simple fact is downvoted without retort.
The common sentiment here is wrong, JSX is a small extension to the grammar of JS. It is JS.