How to use the redux-loop.Effects.constant 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 flow-typed / flow-typed / definitions / npm / redux-loop_v2.2.x / flow_v0.33.x- / test_loop.js View on Github external
//
// liftState
//

// ok
const lifted: [State, Effect] = L.liftState({ first: true, second: false });

//
// loop accessors
//

const state: State = { first: true, second: false };

const loopState: [State, Effect] = loop(
  { first: true, second: false },
  Effects.constant({ type: "SECOND" })
);

// ok
const model1: State = L.getModel(loopState);

// ok
const model2: State = L.getModel(state);

// ok
const effect1: Effect = L.getEffect(loopState);

// ok
const effect2: null = L.getEffect(state);

// $ExpectError
const effect3: Effect = L.getEffect(state);
github flow-typed / flow-typed / definitions / npm / redux-loop_v2.2.x / flow_v0.33.x- / test_effects.js View on Github external
//
// Effects.none
//

// ok
const none: Effect = Effects.none();

//
// Effects.constant
//

// ok
const constant: Effect = Effects.constant({ type: "foo" });

// $ExpectError
Effects.constant({ noTypeProp: "foo" });

//
// Effects.call
//

function zeroArg() {
  return { type: "zeroArg" };
}

function string(x: string) {
  return { type: "string", x };
}

function numberString(x: number, y: string) {
  return { type: "numberString", x, y };
}
github mboperator / infinitely-composable-webapp-demo / src / components / Dashboard / module.js View on Github external
splitRequest: (state, { payload: orientation }) => {
      const effect = orientation !== state.orientation
        ? Effects.constant(module.actions.split(orientation))
        : Effects.constant(module.actions.addChild());
      return loop(state, effect);
    },
    updateChild: ({ children, ...state }, { payload, meta }) => {
github mboperator / infinitely-composable-webapp-demo / src / components / Dashboard / module.js View on Github external
splitRequest: (state, { payload: orientation }) => {
      const effect = orientation !== state.orientation
        ? Effects.constant(module.actions.split(orientation))
        : Effects.constant(module.actions.addChild());
      return loop(state, effect);
    },
    updateChild: ({ children, ...state }, { payload, meta }) => {