React.js is not magical
Last year I wrote a long rant in which I professed my love for React.js. One year later I’ve not much changed in my view, but with the honeymoon period long gone I can express that love with greater maturity and clarity.
I love React because it is the least magical way of developing complex web applications.
I almost never look at the React documentation, because as a React developer I memorized the very small API surface ages ago. And since I’ve recently started using Redux quite heavily, I have found myself writing stateless components quite often, and now React is practically invisible in my day-to-day coding.
The React code I write and read today is pretty much just functions, declared
one after the other after the other. When the file gets too long, I create a new
file and move some of the functions there. Littered throughout this code are
/>. That’s when you know React is playing a role in this app. When I have
some data and I want to show it on the screen, I literally just write the HTML I
want to see and fill in the blanks with real data. I haven’t even had to switch
files, so I haven’t switched physical or mental contexts. It is so easy.
Increasingly, JSX is the only artefact of React I see, so it is easy to forget that React is doing so much heavy lifting. I rarely worry that the UI is out of date or that the UI needs to be updated because data arrived from the server. I also rarely worry about performance. I’m relieved of those concerns because of React’s virtual DOM (but I also never worry about the virtual DOM).