Is it ok to pass setState as a prop in React?
No, it's not
It's possible to pass setState as a prop in React. However, it's not the recommended way to deal with updating state triggered by child components.
Passing down setState makes it hard to reason about the state of the component.
State m...
tigerabrodi.blog2 min read
Pavel
Disagree, it is perfectly OK. First approach looks most clean and easy to understand. Context for this? Overengineering. Passing callbacks? What if you want to increment by custom amount? You would have to pass callback with arguments and in that case it is better to pass just setter. Also setState has stable reference AFIAK, so no need to use useCallback later.