Re:React I love you, but you're bringing me down
by programmarchy on Tuesday September 20, 2022 @12:59PM
(#32914597)
In 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.
Sure methods like componentDidMount are a mouthful but I found it much more explicit