Skip to content

Instantly share code, notes, and snippets.

Created June 30, 2020 11:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save alexmochu/e2bbc9e59355aae74a66e7162f4dc6f1 to your computer and use it in GitHub Desktop.
Create Redux Store
import { applyMiddleware, createStore } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { composeWithDevTools } from 'redux-devtools-extension';
import rootReducer from './reducers';
import rootSaga from './sagas';
export default function configureStore(initialState) {
const sagaMiddleware = createSagaMiddleware();
const middlewares = [sagaMiddleware];
const middlewareEnhancer = applyMiddleware(...middlewares);
const enhancers = [middlewareEnhancer];
const composedEnhancers = composeWithDevTools(...enhancers);
const store = createStore(rootReducer, initialState, composedEnhancers);;
return store;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment