Re:A Critique of React Hooks
by dgritsko on Monday April 27, 2020 @12:32PM
(#22997364)
You could easily wind up with an infinite loop without hooks (for example, by calling `setState` in `componentDidUpdate`).
[ Parent
| on HN ]
That would be trivial to spot. Not the case with hooks.
It's trivial to spot with hooks.
Re:A Critique of React Hooks
by charrondev on Monday April 27, 2020 @10:04PM
(#23002572)
This is definitely not the case. I’ve seen enough class components with complicated componentDidUpdate methods. The method would then be broken up into multiple other smaller methods (or to re-use some logic in didMount and didUpdate)
A few iterations later and you have setState peppered throughout your component.
More often then not though I’ve seen a lot of class components that would just fail to update when certain props change. It’s much harder to miss these cases with hooks.