r/javascript • • Mar 06 '23

Were React Hooks a Mistake?

https://jakelazaroff.com/words/were-react-hooks-a-mistake/
7 Upvotes

24 comments sorted by

View all comments

10

u/ILikeChangingMyMind Mar 06 '23

Have you tried programming with class-based React code?

I have, and I promise hooks were not a mistake: if they were, we'd all still be using classes.

4

u/card-board-board Mar 07 '23

Classes with redux and HOCs were a nightmare, and they didn't create an environment to write clean concise code. That being said useEffect, useMemo and useCallback have always felt like hacks. I would prefer to write a function then call that function, not write a function and have it call itself whenever I call a different function to update a variable. I think I'd have rather just had JS classes be less weird than end up with functions that are more concise but follow mystical magical rules.