FWIW, the "stale props/zombie child" issues described in the React-Redux hooks docs [0] really have nothing to do with the hooks themselves. It's a combination of:
- The long-standing problem of trying to synchronize an external synchronous state container with React's async rendering cycle
- That our existing solution for this problem requires overriding values in context for connected components
- The fact that context usage _require_ rendering a <Context.Provider> to update a value
- The fact that hooks themselves do not do any rendering
So, the solution we have for avoiding stale props only works with `connect`. It's not that the hooks themselves are problematic or have inherent gotchas, it's just that hooks don't offer the specific additional capability we would need to implement that same solution in both places.
A user just put together a _fantastic_ article that dives deeper into this specific problem, and recaps how each version of React-Redux tried to solve it [1]. Highly recommended reading if you have some time.
- The long-standing problem of trying to synchronize an external synchronous state container with React's async rendering cycle
- That our existing solution for this problem requires overriding values in context for connected components
- The fact that context usage _require_ rendering a <Context.Provider> to update a value
- The fact that hooks themselves do not do any rendering
So, the solution we have for avoiding stale props only works with `connect`. It's not that the hooks themselves are problematic or have inherent gotchas, it's just that hooks don't offer the specific additional capability we would need to implement that same solution in both places.
A user just put together a _fantastic_ article that dives deeper into this specific problem, and recaps how each version of React-Redux tried to solve it [1]. Highly recommended reading if you have some time.
[0] https://react-redux.js.org/api/hooks#stale-props-and-zombie-...
[1] https://kaihao.dev/posts/Stale-props-and-zombie-children-in-...