createEpicMiddleware(rootEpic, [options])

createEpicMiddleware() is used to create an instance of the actual redux-observable middleware. You provide a single, root Epic.

Arguments

  1. rootEpic: Epic: The root Epic
  2. [options: Object]: The optional configuration. Options:
    • dependencies: If given, it will be injected as the 3rd argument to all epics.

Returns

(MiddlewareAPI): An instance of the redux-observable middleware.

Example

redux/configureStore.js

import { createStore, applyMiddleware, compose } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import { rootEpic, rootReducer } from './modules/root';

const epicMiddleware = createEpicMiddleware(rootEpic);

export default function configureStore() {
  const store = createStore(
    rootReducer,
    applyMiddleware(epicMiddleware)
  );

  return store;
}

results matching ""

    No results matching ""