Can We All Just Admit React Hooks Were a Bad Idea?

Amy Blankenship
CodeX
Published in
10 min readJul 9, 2022

--

Part 1: SOLID reasons why hooks are a bad idea

Dead fish hanging from hooks in a market
Photo by Clay Banks on Unsplash

I’ve noticed a troubling tendency in the JavaScript world recently, particularly in the React community. That tendency is for people to suddenly “discover” that decades of best practices somehow don’t apply to them anymore. This wouldn’t be so bad if this was just random people writing Medium posts, but this thinking has taken hold to the extent that it has caused the React project and other important related projects, like Redux, to walk away from tried-and-true principles that enabled teams to create scalable, maintainable software. They’ve recreated a world I thought we’d well left behind, where View components reach out and take whatever they want from wherever it happens to have landed, and you can spend hours or even days trying to figure out exactly which little fragment changed your data in some unexpected way. And then it can take you even longer to figure out how to shoehorn the fix in among this tightly-coupled monstrosity.

Today I’m going to walk through how hooks violate SOLID principles from Object Oriented Design. I can hear you already objecting (in my mind — you haven’t read this yet) that React with hooks are not OOD. I’m going to have to stop you right there, reader in my mind, because while React components with hooks might not use OO syntax, they’re definitely not…

--

--

Amy Blankenship
CodeX

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.