Created
June 30, 2020 11:15
-
-
Save alexmochu/e2bbc9e59355aae74a66e7162f4dc6f1 to your computer and use it in GitHub Desktop.
Create Redux Store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
sagaMiddleware.run(rootSaga); | |
return store; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment