Last active
October 18, 2017 01:43
-
-
Save de314/495a80e88eff23509e0061a8d7752762 to your computer and use it in GitHub Desktop.
Init Redux
This file contains hidden or 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 { createStore, applyMiddleware, compose } from 'redux'; | |
import persistState from 'redux-localstorage' | |
import createSagaMiddleware from 'redux-saga' | |
import rootReducer from './state' | |
// https://redux-saga.js.org/ | |
import rootSaga from './sagas' | |
const sagaMiddleware = createSagaMiddleware() | |
const middleware = [sagaMiddleware] | |
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | |
const store = createStore( | |
rootReducer, | |
/* preloadedState, */ | |
composeEnhancers( | |
applyMiddleware(...middleware), | |
persistState('auth'), | |
) | |
); | |
sagaMiddleware.run(mySaga) | |
export default store; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment