| I am mostly a spectator in this argument, since I'm holding out as long as possible on committing to hooks, but the impression I got from the React Hooks FAQ is that hooks are supposed to be a silver bullet: > Should I use Hooks, classes, or a mix of both? [0] > When you’re ready, we’d encourage you to start trying Hooks in new components you write. [snip] > Do Hooks cover all use cases for classes? [1] > Our goal is for Hooks to cover all use cases for classes as soon as possible. [snip] The answer about higher-order components is a little more nuanced but does say hooks should replace most of them: > Do Hooks replace render props and higher-order components? [2] > Often, render props and higher-order components render only a single child. We think Hooks are a simpler way to serve this use case. There is still a place for both patterns (for example, a virtual scroller component might have a renderItem prop, or a visual container component might have its own DOM structure). But in most cases, Hooks will be sufficient and can help reduce nesting in your tree. Learning enough about the React lifecycle to make simple apps was a big task, but it felt like a bounded one for my purposes. Learnings hooks seems... strangely open-ended. There's a small set of built-in hooks that do certain things, and if I need more I'm supposed to build new hooks out of the old ones, and that's supposed to be it. Except that it isn't, because if that's all there was to it, people wouldn't be having difficulty. I just wish the rest of the story was sketched out and bounded for me in some way so I could know what I was getting into. [0] https://reactjs.org/docs/hooks-faq.html#should-i-use-hooks-classes-or-a-mix-of-both
[1] https://reactjs.org/docs/hooks-faq.html#do-hooks-cover-all-use-cases-for-classes
[2] https://reactjs.org/docs/hooks-faq.html#do-hooks-replace-render-props-and-higher-order-components
|
I remember people having difficulty with callbacks, then with generators, then with promises, Obersavables... you get the point. There is always something new that tries to make 80% of the cases trivial with a new elegant syntax that hides a lot of complexity, and comes with that 20% of cases where it is harder to grasp.