Also I’m pretty sure it don’t add data dependencies! Only the the dependencies that retrigger the effect
Re:React is a fractal of bad design
by c-hendricks on Wednesday March 08, 2023 @03:36PM
(#35074397)
This pattern (event -> state change -> effect run) is finally advised against in the new React docs: https://beta.reactjs.org/learn/you-might-not-need-an-effect
See "You don’t need Effects to handle user events".
And are you sure the data in useEffect is stale? I don't think it is, the documentation[0] seems to suggest that it uses the current closure.
The rest I agree with.
[0] https://reactjs.org/docs/hooks-effect.html#example-using-hoo...