Skip to content

Instantly share code, notes, and snippets.

@DimaDaxDadeco
Created June 14, 2018 06:26
Show Gist options
  • Save DimaDaxDadeco/b38eb85c0e77461bd1c71187352ac961 to your computer and use it in GitHub Desktop.
Save DimaDaxDadeco/b38eb85c0e77461bd1c71187352ac961 to your computer and use it in GitHub Desktop.
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