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.

-1

u/[deleted] Mar 06 '23

Whoa whoa whoa let's stay above the belt here. Classes were a mistake from jump, but let's keep it classy but classless 😂

0

u/ILikeChangingMyMind Mar 06 '23

I honestly didn't think there was anything "unclassy" about my comment.

-1

u/[deleted] Mar 06 '23 edited Mar 06 '23

It was a joke, that's why the emoji

Edit: also a play on words not a pun