Hacker News new | ask | show | jobs
by ricardobeat 1778 days ago
I've been through two large-scale projects now where we went 100% into hooks, and after a couple years the excitement has faded and I often wonder if it was worth it. It seems to end up making code even more complex than before, even though components look simpler on the surface. Not enough to go back to classes, but doesn't feel as good as those first steps. I absolutely hate the manual dependency tracking and having every single thing be wrapped in a useX() method to avoid unnecessary updates.
4 comments

... having every single thing be wrapped in a useX() method to avoid unnecessary updates

That is a bit annoying, but it's significantly less annoying than having a single huge componentShouldUpdate function that deals with everything a complicated component uses.

Hooks don't really change the work a component does. The logic is essentially the same. They just break it down in to smaller, more reusable, more declarative units. That's usually nicer to work with and a lot more "React-y".

Is it really that bad? eslint-plugin-react-hooks installs by default when creating a project with create-react-app, which basically does the work for you.
In my opinion, the issue here is going 100%. There are use cases where having a class component is easier to manage, f.ex: if you make use of external classes.
Same experience here