37 ms·
The translation from JSX to JS is rather easy, though. It is just syntactic sugar.
by codethief 3y ago
The translation from JSX to JS is rather easy, though. It is just syntactic sugar.
- ipaddr 3y agoThe class vs className breaks every css style.
- zdragnar 3y agoIt is a macro ("syntactic sugar") for JavaScript, not HTML.
- whizzter 3y agoYou still need a full JS(x) parser (and lexer) though since / symbols are contextual (as are < in JSX). / and < in operator positions becomes operators, whilst / in plain JS in a value position becomes the start of an reg-exp and < becomes the start of an JSX tag, so to handle it there needs to be a full parser (with a pull-lexer to correctly handle the contextual part) as you cannot just do a textual replacement due to ambiguity.