Is React Hard to Learn?
If you follow the frontend tech scene on Twitter you have probably noticed that every once in a while some topics like React or CSS in JS trigger open-ended, long debates and arguments on the validity and approachability of such technologies.
Often such arguments don't have any resolution or constructive outcome as each part has valid reasons to defend their claim and the counter part fails at seeing their point or empathise.
Is React really hard to learn though? Yes and no. In this blog post I will try to explain why.
Yes, it is!
Many of us learn new things on the job: hands-on new tech and problems are a good way to acquire knowledge.
Sometimes though, learning on the job is like changing a tire while the car is running.
Learning overlaps with the time budget that we have allocated to complete our task and get the job done. Having to do both can be the most overwhelming thing!
For somebody who is not very comfortable with JavaScript and React it could be challenging to complete the most trivial task. This is not because React is necessarily hard to grasp or the developer is not good enough, but rather because what surrounds or constitutes the problem is not within the boundaries of our existing knowledge and comfort zone.
If you are comfortable with modern JavaScript and React, take a moment to think about how uncomfortable it would be to do something as simple as using render props or defining a lifecycle method with another framework or language that you've never used before.
Usually we want to go from A to B, but we don't know how! For sure we would be able to do the same with another language or framework that we already know but that's not the case and this leads to frustration.
For example occasionally at work I get to write some Elixir and I often spend a good amount of time trying to figure out how can I do X or Y with it.
Like many other technologies, React solves many problems in a brilliant way but the initial discomfort and lack of knowledge might lead us thinking that it is just unnecessary hyped tech or even useless, overengineered and bad.
The fact that React is not a full blown framework then forces developers to make a lot of decisions that can be a (temporary) blocker for many.
Learning React can be
uncomfortable if you are new to it and don't have the necessary amount of time or patience to familiarise with it but so is anything else and I personally think that in the long term it is worth the effort.Overcoming discomfort is often necessary to unlock new opportunities and we shouldn't let it stop us from trying new things and rush to premature conclusions.
If you are a developer advocate or a tech influencer you may want to keep in mind all the above and address this type of audience when you advocate for a technology rather than targeting your (already) loyal one.
No, it is not!
The other side of the story is that React is not that hard to grasp after all.
To its core React is a JavaScript library to create user interfaces by nesting elements to form a tree, similarly to the DOM.
Elements are created by using an HTML-like markup language called JSX - yep HTML in JavaScript.
React Components are JavaScript functions that take properties as input and return elements as output.
A React application is itself a component that is attached to a container in the web page.
With this little knowledge and a read of the docs somebody with HTML and JavaScript understanding can start building UIs with React.
This is all I knew before I took my first React job.
What made it easy for me was the fact that I could assimilate the basic knowledge for fun in my spare time without the pressure of having to get the job done.
When I had to use React at work the other crucial bit for me was the fact that the development enviroment was already set up: other engineers had configured webpack, Babel etc.
Due to its large adoption there is a vibrant community around React, with plenty of places where you can ask for help and pre-configured frameworks like Next.js or Create React App, which can lower the barrier to entry.
The React website has even a quick guide called Add React in One Minute that will help you get started in ... well, one minute 😅
Conclusion
Often people express their thoughts or discomfort publicly without wanting to start a weekend-long debate, drama or, worse, attack and shame other folks – Brad Frost wrote a blog post about this topic and I highly recommend to read it.
Learning something new like React could be intimidating and hard, especially when you don't have the chance to do so for fun and take all the time you need to get comfortable with a that technology.
It is good to keep in mind that whether you can do this or not is not the technology's fault.
React is pretty good at what it does and in the right situation even easy to learn.
✌️