5 ms·
The real problem with JSX is that it's almost HTML, but not quite, so you constantly have to fight against your assumptions about how it should work. At least
by couchand 9y ago
The real problem with JSX is that it's almost HTML, but not quite, so you constantly have to fight against your assumptions about how it should work.
At least JS is really just JS, and developers have been reading, mentally modeling and reasoning about JS -> execution translation for decades.
- Sir_Cmpwn 9y agoJSX got closer to just HTML recently, now that you can specify HTML attributes in addition to DOM properties.
- spankalee 9y agoFor an alternative to JSX that's actually real HTML, but also real JS and requires no compiler, checkout lit-html: https://github.com/Polymer/lit-html https://github.com/Polymer/lit-html It lets you write HTML templates as JS template literals: let post = (title, body) => html` <h1>${title}</h1> <div>${body></div>`; But unlike using innerHTML, it stamps DOM from <template> elements, and only updates parts that change, actually doing less work than VDOMs. Lots of editors have automatic support for inline HTML tagged with a tag named "html", so you'll get syntax highlighting in say, Atom. And VS Code has a plugin that adds intellisense.