You’re Missing the Point of React
After a year of using React and observing people learning it, I can say that the best parts of React are not the ones that made it famous.
They’re not virtual DOM, custom event system, server rendering or JSX. Rather, they are a few boring, old and powerful ideas.
Using other people’s code is like surfing. You control and surrender. You’ve got to trust the wave to carry you, but stop paying attention, and the first abstraction leak will throw you under the water.
When we see something that is new both technologically and philosophically, we tend to focus on the technology part because we need to tame the magic first. We’ve had enough of black boxes in our careers. We want to understand—if not the full picture, then at least up to the level where we can make a snarky comment that is also correct to some degree.
“How” is more viral than “why” at this point.
“What’s new?” is an interesting and broadening eternal question, but one which, if pursued exclusively, results only in an endless parade of trivia and fashion, the silt of tomorrow. I would like, instead, to be concerned with the question “What is best?,” a question which cuts deeply rather than broadly, a question whose answers tend to move the silt downstream.
When React came out, virtual DOM got everyone talking. It was a breakthrough and, like any good piece of engineering, it was built with carefully considered tradeoffs.
The concept was so simple and powerful at the same time that it became the way people introduce and differentiate React from other front-end frameworks and libraries. “React is a view layer that uses virtual DOM for performance.” Another motto you can often hear is “React can be used as the V in MVC.” At the time, downplaying React’s role in application architecture was intentional because React already had too many “seemingly bad” ideas to risk alienating people by adding some more.
In fact, React is not at all about virtual DOM. It’s an implementation detail that made React famous, but it overshadowed other concepts that are less shiny but more important in the long run.
Now that we’re not surprised by virtual DOM anymore and it is being adopted by other frameworks and libraries, we can focus on examining React’s true strengths: composition, unidirectional data flow, freedom from DSLs, explicit mutation and static mental model.
We will examine these topics in next articles.
To be continued.