How to use the redux-loop.Cmd.run function in redux-loop

To help you get started, we’ve selected a few redux-loop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChartIQ / finsemble-seed / src-built-in / components / UIAPI / reducers / linker.js View on Github external
export default function(state = initialState, action) {
    console.log("state", state);
    switch (action.type) {
        case TOGGLE_CHANNEL:
            const newState = {
                ...state,
                channels: state.channels.map(c => channel(c, action))
            };
             // Side effect to link/unlink the channel
            const cmd = Cmd.run(linkChannel, {
                args: ["test"]
            });

            console.log("after cmd.run");
            console.log("newState", newState);
            return loop(newState, cmd);
        default:
            return state;
    }
}
github ioof-holdings / redux-subspace / examples / redux-loop / redux-loop-example / src / counter.js View on Github external
[Actions.longIncrementStart]: (state, amount) => {
    console.log('long start');
    return loop(state
      .setIn(['long', 'loading'], true)
      .setIn(['long', 'failed'], false),
    Cmd.run(Api.longIncrement, {
      successActionCreator: Actions.longIncrementSucceed,
      failActionCreator: Actions.longIncrementFail,
      args: [amount]
    }))
  },
github ioof-holdings / redux-subspace / examples / redux-loop / redux-loop-example / src / counter.js View on Github external
[Actions.shortIncrementStart]: (state, amount) => {
    console.log('short start');
    return loop(state
      .setIn(['short', 'loading'], true)
      .setIn(['short', 'failed'], false),
      Cmd.run(Api.shortIncrement, {
        successActionCreator: Actions.shortIncrementSucceed,
        failActionCreator: Actions.shortIncrementFail,
        args: [amount]
      })
    )
  },