Is React hard to learn?

Paradoxically, React might feel more difficult at first than other frameworks because it is simpler in the sense that it uses more general, less ad-hoc mechanisms.

The Vue documentation is amazingly well-written. But I suspect Vue sometimes feels easier because each concept that you need to build an application with Vue.js maps explicitly to a part of the Vue.js API.

For example, the UI is not just the return value of a function; it’s labelled template in the actual code that you write. It’s not enough to define a function to create a component; you must call a special function called component. While it is very ad-hoc, it makes it pretty clear: just call the function with the same name as the thing you want to do! Even data has a special key named data.

React relies on similar concepts, but there isn’t a one-to-one mapping between a concept and code. A component is just a function or a class. State is whatever you decide to call setState() on. Props are just function arguments. Components themselves can do pretty much anything. Commonly they’re introduced by saying that they define the UI, but then you have components like BrowserRouter and Motion that don’t define any visible UI by themselves.

React relies on a smaller number of primitives and asks you to compose them in a flexible way. That’s contributed to its success, because it encourages experimentation (would there be React Native or CSS-in-JS without this). But this very minimalism makes the first approach confusing.

On the other hand, once you get over the first obstacles, React requires you to just remember less. There’s no separate scope rules for templates, no component registration, no difference between observed and regular values, no special function to call except setState(). It’s plain JavaScript all the way down.

Some other frameworks handle each special case in a single, predefined way but force you to remember a lot of different APIs. React spares you this but requires a little more abstract thinking. Whether you’re more comfortable with one or the other depends on you experience and the style of applications you’re building, but React’s approach is probably more powerful.