|
|
|
|
|
by gloosx
258 days ago
|
|
fair — what feels natural usually depends on what you are used to. But even aside from preference, JSX aligns directly with how JavaScript itself works. You are not learning a new templating DSL — you just compose functions. That conceptual unity is what makes React approach click for for so many. |
|
Why javascript, though? That preference, again, seems based on what you’re used to.
The actual goal is to manipulate the DOM based on state changes using a declarative representation.
Javascript seems more like something that was available rather than a good fit. (In fact, they felt like it was a bad enough fit that JSX had to be added to the mix.)
Setting aside any particular framework, HTML seems like a better fit to me… it’s inherently declarative and, of course, has a well understood, well supported relationship with the DOM. Extensions to bind state can be pretty well contained.