Redux saga,如何从组件中监听一个动作

Redux saga, How to listen to an action from component

在 Redux 中,组件将使用 reducers 中的 props 进行渲染。

但我看到的是,使用 setState 有很多情况更容易。并非所有组件的状态都应该在 reducer 中,否则其引入的 reducer 复杂性。

所以问题来了。

如何监听组件的 setState 动作?就像 Saga 中的 take

对此没有简单的答案。基本上,您正在探索处理 redux 操作及其每个组件存储的可能性。

引自official documentation

There are a number of community packages that implement various approaches for storing per-component state in a Redux store instead, such as redux-ui, redux-component, redux-react-local, and more.

这些是上述库的链接:

还有KeaJS,值得一看:https://kea.js.org/