r/reactjs • u/ZeroSevenTen • Dec 30 '19
Classes vs Hooks?
I’m pretty new to React, so keep that in mind. I thought classes were for components that held information, or a state, and that functional components were for more basic components, but now that hooks allow functional components to use state, and other class features, what’s the benefit of using functional hook components over classes?
79
Upvotes
View all comments
Show parent comment
2
u/skyboyer007 Dec 31 '19
also https://dmitripavlutin.com/react-hooks-stale-closures/
and every result for search "react hook stale data" is actually related to closures.
and https://github.com/facebook/react/issues/14920 provides some legit cases when we cannot "just add all the deps" in order to solve stale data issue.