How to use the redux-observable.reduxObservable function in redux-observable

To help you get started, we’ve selected a few redux-observable 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 redux-observable / react-redux-observable / test / dispatchOnMount-spec.js View on Github external
it('should accept factories that get invoked with props', () => {
    let reducedActions = [];
    let reducer = (state, action) => {
      reducedActions.push(action);
      return state;
    };
    let store = createStore(reducer, applyMiddleware(reduxObservable()));

    @dispatchOnMount(
      (props) => ({ type: 'PLAIN_ACTION', value: props.value }),
      (props) => () => Observable.of({ type: 'SOURCE2', value: props.value }))
    class TestComponent extends Component {
    }

    let comp = new TestComponent({ value: 'Bilbo Bagginses' });
    // fake connection?
    comp.context = { store };
    comp.componentDidMount();

    expect(reducedActions).to.deep.equal([
      { type: '@@redux/INIT' },
      { type: 'PLAIN_ACTION', value: 'Bilbo Bagginses' },
      { type: 'SOURCE2', value: 'Bilbo Bagginses' }
github istarkov / redux-observable-process-fetch / tests / createFetchProcess.spec.js View on Github external
const ctreateStoreWithReduxObservableMiddleware = (services) => {
  const reducer = (state = [], action) => state
    .concat(action)
    .filter(({ type }) => ['@@redux/INIT', FETCH_DATA, FETCH_CLEAR_CACHE].indexOf(type) === -1);
  // create Processor
  const processor = combineDelegators(
    createFetchProcess(services)
  );
  const middleware = reduxObservable(processor);

  const store = createStore(reducer, applyMiddleware(middleware));
  return store;
};