3 ms·
JSX is not HTML, even though its syntax is very similar. It’s a data structure that’s renderer-agnostic. It can be rendered to HTML, or to a live DOM, or to oth
by eyelidlessness 6y ago
JSX is not HTML, even though its syntax is very similar. It’s a data structure that’s renderer-agnostic. It can be rendered to HTML, or to a live DOM, or to other outputs. IIRC, Netflix uses React to render at least some components on entirely non-web interfaces like smart TVs.
To me, that fact is what makes React (and other libraries like Preact that have a similar interface) more compelling than the template-oriented alternatives. As far as I’m aware, Flutter takes basically the same approach, just with different syntax. I believe the same is true of SwiftUI. And Elm, and the various UI libraries for Clojure.
And as another comment mentioned, you can use a variety of CSS-in-JS approaches, which at least last time I looked is actually the more common approach in the React community.
Add in TypeScript (or whatever static type system in whatever compile to JS language), and you’re basically comparing bike sheds at this point.
- TheMagicHorsey 6y agoSemantics. The fact is you need to change syntax to describe your layout, instead of just using the syntax of the language you are already coding in.