12345678910111213141516171819202122232425 |
- import { createStore, applyMiddleware, compose } from 'redux';
- import thunkMiddleware from 'redux-thunk';
- import { initialState, rootReducer } from '../reducers/root';
- export default function configureStore() {
- /* eslint-disable no-underscore-dangle */
- const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
- /* eslint-enable */
- const store = createStore(
- rootReducer,
- initialState,
- composeEnhancers(applyMiddleware(thunkMiddleware)),
- );
- if (module.hot) {
- // Enable Webpack hot module replacement for reducers
- module.hot.accept('../reducers/root', () => {
- const nextRootReducer = require('../reducers/root').default;
- store.replaceReducer(nextRootReducer);
- });
- }
- return store;
- }
|