import {createStore, applyMiddleware} from 'redux' import thunkMiddleware from 'redux-thunk' import createLogger from 'redux-logger' import rootReducer from './reducer' export default function configureStore (initialState) { const store = createStore( rootReducer, initialState, applyMiddleware( thunkMiddleware, createLogger({collapsed: true}) ) ); if (module.hot) { module.hot.accept('./reducer', () => { const nextReducer = require('./reducer.js').default; store.replaceReducer(nextReducer); }) } return store; }