Skip to content

Instantly share code, notes, and snippets.

@DengYiping
Created December 3, 2018 09:00
Show Gist options
  • Save DengYiping/9117efd390d8fe7b50063bfcdb7fc21e to your computer and use it in GitHub Desktop.
Save DengYiping/9117efd390d8fe7b50063bfcdb7fc21e to your computer and use it in GitHub Desktop.
Configure Redux Store and Redux Observable
import rootReducer from '../reducer/rootReducer';
import { createStore, applyMiddleware } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import rootEpic from '../epic/rootEpic';
function configureStore(default_state = {}){
const epicMiddleware = createEpicMiddleware();
const store = createStore(
rootReducer,
default_state,
applyMiddleware(epicMiddleware)
);
epicMiddleware.run(rootEpic);
return store;
}
export default configureStore;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment