Skip to content

Instantly share code, notes, and snippets.

@DubiousS
Created June 17, 2019 08:00
Show Gist options
  • Select an option

  • Save DubiousS/20b329b11568bb9a3a6ec90470025a49 to your computer and use it in GitHub Desktop.

Select an option

Save DubiousS/20b329b11568bb9a3a6ec90470025a49 to your computer and use it in GitHub Desktop.
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
import rootReducer from './root-reducer';
import createHistory from 'history/createBrowserHistory';
import { connectRouter, routerMiddleware } from 'connected-react-router';
import createSagaMidleware from 'redux-saga';
import rootSaga from './root-saga';
export const history = createHistory();
const sagaMidleware = createSagaMidleware();
const midlewares = [
routerMiddleware(history),
sagaMidleware,
];
export const store = createStore(
connectRouter(history)(rootReducer),
{},
composeWithDevTools(
applyMiddleware(
...midlewares
)
)
);
sagaMidleware.run(rootSaga);
export default store;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment