3 ms·
I overall agree. I use functional style programming a lot but for some reason hooks have always confused me. The component classes generally make sense to me an
by 3vidence 4y ago
I overall agree. I use functional style programming a lot but for some reason hooks have always confused me. The component classes generally make sense to me and map onto other paradigms like flutter, vue, etc.
Sure methods like componentDidMount are a mouthful but I found it much more explicit
- programmarchy 4y agoIn my view, hooks are more about managing state dependencies, rather than functional programming, per se. So they're more useful for simplifying methods like componentDidUpdate, rather than componentDidMount. When you need to detect changes by comparing prevProps to this.props or prevState to this.state, the logic can quickly get really ugly. Instead you can just put the relevant prop or state you want to monitor in the dependency list of a hook, and it will be triggered whenever that dependency list changes.