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

4

u/roofgram Mar 07 '23

useState, useCallback, useMemo, useRef, etc.. are all kind of hacks because you can't store state in a functional component itself. Plus the fact that closures wrap old state result in failure cases you will eventually hit like in this blog post. I've definitely had to revert to class components a few times because of this and it makes me think if usings were a mistake. Classes were more code, but nothing magic; functional components are smaller but need a lot of this 'using' magic to work.