Member-only story

Hot take šŸ”„. React Hooks are bad for your code. Hereā€™s why!

Richard Oliver Bray
8 min readMay 25, 2022

--

Photo by Trophy Technology on Unsplash

Iā€™ve recently developed a dislike for hooks after trying to refactor some old React code, Iā€™ve come to the realisation that hooks are not great for abstraction. Yes I know you can create custom hooks but they donā€™t quite solve the issues I raise. I present some weak solutions in this article but ultimately, I think there needs to be more freedom on how and where hooks are used in the codebase.

Also, React plugin authors should stop making tools that only work with hooks. There are other ways to run things in Javascript.

Note: This is 100% my opinion. Iā€™m not a massive deal in the web dev world so donā€™t take what I say as gospel. Do what works best for your team and your project. Also, please read this article to the very end before forming an opinion.

Watch this article on YouTube

If youā€™re more of a watcher than a reader, go ahead and click on the video below. Otherwise, enjoy the rest of this article šŸ˜

What are hooks in React?

--

--

Richard Oliver Bray
Richard Oliver Bray

Written by Richard Oliver Bray

Co-founder of orva.studio. Building digital products and teaching others to do the same. Saved by grace.

Responses (22)