Hacker News new | ask | show | jobs
by falcolas 3795 days ago
Without taking sides, understanding your application requires a fairly complete understanding of React, JSX, Javascript, the DOM, and how React ties all of this stuff together. Sure, your code by itself is quite small, but when you add React, it grows by the size of React.

On the other hand, just by knowing Javascript and the DOM, you can understand exactly what is happening in the OP's code.

2 comments

Well, technically you don't need to know JSX, but it pays off to know it IMHO. Moreover, the DOM API is much more complicated than React API and the latest doesn't depend on the particular browser you are using.

But yes, to use a technology, you need to understand it.

Regarding the size, you are right, I wouldn't recommend to use React for such a tiny task.

IMHO, the JSX as used in this example is pretty obvious if you know ES6 syntax. The only "weird" part is curly braces for data interpolation, but even that is pretty semantically obvious.
Regarding size, a Mithril/MSX implementation would look about the same.
You make a fair point. That said, one of the nice things about React is that even a moderately experienced JS programmer can learn the basic mechanics (including how to use JSX) in a few hours. That’s a reasonable investment for a useful tool, and React has a much shorter learning curve than most of the larger JS frameworks.