Flux Actions 到 Redux Actions 的转换

Flux Actions to Redux Actions Conversion

嗨,我有一个动作设置,但它在不断变化,我需要重构它以匹配 Redux 动作。

非常感谢将两者迁移到 redux 的任何帮助。

在评论中回答您的问题;

How do I use my bind functions as in this reducer with redux? Anad how would I go about this.emit("change") in redux?

在 redux 中,您将组件连接到 Redux 状态,如下所示:

ReduxEnabledComponent = ReactRedux.connect(
    function(state) {
        return {
            someProp: state.someProp
        },
    {
        someAction: function(){
            return {type: 'action_type', data: {}}
        }
    }
)(Component);

以上代码将使用名为 Component 的组件并将其连接到 Redux Store。该组件将接收 someProp 的道具,这是 Redux Store 的一个值,以及 someAction,这是一种用于向商店发出请求的方法。