React is becoming a black box
It pains me to say it, but React on the verge of becoming a black box. On any given day, just search “React hooks” or “React Concurrent Mode” on Twitter and you’ll inevitably stumble upon a conversation that goes something like this:
Not many folks are talking about it publicly, perhaps for fear of embarrassment or exposing their lack of knowledge, but recent Twitter banter over the last few months as well as conversations I’ve had with a handful of “thought leaders” have made it clear that very very few people in the community understand how React works now. I hope I am wrong, but I am very concerned that forthcoming Concurrent Mode is going to make React even more difficult to reason about.
Remember that React is supposed to take care of the “how” so that we can focus on the “what” of our apps. This mantra though, assumes that we can predict the “how”-part correctly. I’m worried that the causality of the framework (i.e. the voice inside your head that says “if this, then that” when you’re coding) is becoming opaque to even power users, let alone beginners. I wish I had more feedback or even a suggested solution about how to fix this, but I haven’t figured it out yet. Thus, my only suggestion would be to perhaps take extra care when the React team releases Concurrent Mode (and/or whatever comes next) to re-teach people about how to reason about React. I think a good ol’ Pete Hunt-style “Thinking in X mode” blog post would go a long way. Anyways, that’s it for my hot take. What do you think?
I wrote this post back in October 2019 and shared it privately with Tom Occhino, the Engineering Director of the React Group at Facebook. He was very receptive to the feedback and sentiment. Fast forward to August 2020, I reached out to Tom again to share my continued frustration with the lack of communication and how it was impacting some of my business decisions around React and the web in general.
Here was his response from our DM (and yes, Tom gave me the okay to post this publicly):
Almost year later, I still stand by the content of my initial post. However, I know that the React team is actively working on rewriting the official React documentation from scratch to be hooks-first. I’m hopeful that this should solve a lot of the issues I describe above.
I’m still crazy excited for Concurrent Mode and the next generation of UI it will unlock. I’m also certain that the React team is going to get it right and we’ll all look back on these years as the mid-life crisis of React. But damn, the suspense is killing me.
If you liked this post, you might also enjoy some of my other rants: