Created
June 14, 2018 06:26
-
-
Save DimaDaxDadeco/b38eb85c0e77461bd1c71187352ac961 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 { createStore, combineReducers, applyMiddleware } from 'redux'; | |
// import thunk from "redux-thunk"; | |
const reducer = (state = {}, action) => { | |
switch (action.type) { | |
case 'HI_': { | |
debugger | |
return { | |
...state, | |
hi: 'hi' | |
} | |
} | |
default: return state | |
} | |
} | |
const reducers = combineReducers({ | |
reducer | |
}); | |
export function configureStore(initialState = {}) { | |
const rootReducer = reducers; | |
const store = createStore( | |
rootReducer, | |
initialState, | |
// applyMiddleware(thunk) | |
); | |
if (module.hot) { | |
module.hot.accept(reducers, () => { | |
const nextRootReducer =reducers; | |
store.replaceReducer(nextRootReducer); | |
}); | |
} | |
return store; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment