2016-06-09 22:41:40 +00:00
|
|
|
import { createStore, applyMiddleware, compose } from 'redux'
|
|
|
|
import thunk from 'redux-thunk'
|
2016-06-22 19:58:23 +00:00
|
|
|
import rootReducer from './reducers'
|
2016-05-05 21:48:26 +00:00
|
|
|
|
|
|
|
export default function configureStore(initialState) {
|
|
|
|
const store = createStore(
|
|
|
|
rootReducer,
|
2016-06-09 22:41:40 +00:00
|
|
|
initialState,
|
|
|
|
applyMiddleware(thunk)
|
2016-05-05 21:48:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if (module.hot) {
|
|
|
|
// Enable Webpack hot module replacement for reducers
|
2016-06-22 19:58:23 +00:00
|
|
|
module.hot.accept('./reducers', () => {
|
|
|
|
const nextRootReducer = require('./reducers').default
|
2016-05-05 21:48:26 +00:00
|
|
|
store.replaceReducer(nextRootReducer)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return store
|
|
|
|
}
|