3 ms·
> Stateful "functions" is just so asinine I don't even know where to begin So, a closure? I see gripes about hooks mostly on hn. Most of the industry loves it
by j-krieger 6y ago
> Stateful "functions" is just so asinine I don't even know where to begin
So, a closure?
I see gripes about hooks mostly on hn. Most of the industry loves it, and for good reason. There is nothing to „understand“ about hooks. You don‘t have to think about what should happen when. Just use hooks to get what you want and forget the rest. If anything, it‘s easier than before.
- datagram 6y agoI personally love hooks, but I can't agree with the claim that "there is nothing to understand about hooks." For starters, they have to be used in a specific way, or else it causes bugs[1]. And there are plenty of other potentially non-obvious things in the (lengthy) FAQ[2]. Once you understand how hooks work they're much easier to work with than class components, but there's definitely a learning curve to using them correctly for anything beyond the simplest use cases. [1]: https://reactjs.org/docs/hooks-rules.html https://reactjs.org/docs/hooks-rules.html [2]: https://reactjs.org/docs/hooks-faq.html https://reactjs.org/docs/hooks-faq.html