-
-
Save LukeSmetham/03e057f41f710316874cdfe950d51f42 to your computer and use it in GitHub Desktop.
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 { compose, createStore, applyMiddleware } from 'redux'; | |
import createSagaMiddleware from 'redux-saga'; | |
import thunkMiddleware from 'redux-thunk'; | |
import createReducer from './createReducer'; | |
import sagas from './rootSaga'; | |
let store; | |
export default () => { | |
const reducer = createReducer(); | |
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | |
const middleware = []; | |
const sagaMiddleware = createSagaMiddleware(); | |
middleware.push(sagaMiddleware); | |
middleware.push(thunkMiddleware); | |
store = createStore(reducer, composeEnhancers(applyMiddleware(...middleware))); | |
sagaMiddleware.run(sagas); | |
return store; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment