createEpicMiddleware()
is used to create an instance of the actual redux-observable middleware. You provide a single, root Epic.
rootEpic: Epic
: The root Epic[options: Object]
: The optional configuration. Options:dependencies
: If given, it will be injected as the 3rd argument to all epics.adapter
: An adapter object which can transform the input / output streams provided to your epics. Usually used to adapt a stream library other than RxJS v5, like adapter-rxjs-v4 or adapter-most Options:input: ActionsObservable => any
: Transforms the input stream of actions,ActionsObservable
that is passed to your root Epic (transformation takes place before it is passed to the root epic).output: any => Observable
: Transforms the return value of root Epic (transformation takes place after the root epic returned it).
(MiddlewareAPI
): An instance of the redux-observable middleware.
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;
}