mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-12-02 06:23:53 +03:00
26 lines
604 B
JavaScript
26 lines
604 B
JavaScript
import { createStore, compose } from 'redux';
|
|
import { persistState } from 'redux-devtools';
|
|
import rootReducer from '../reducers';
|
|
import DevTools from '../containers/DevTools';
|
|
|
|
const enhancer = compose(
|
|
DevTools.instrument(),
|
|
persistState(
|
|
window.location.href.match(
|
|
/[?&]debug_session=([^&#]+)\b/
|
|
)
|
|
)
|
|
);
|
|
|
|
export default function configureStore(initialState) {
|
|
const store = createStore(rootReducer, initialState, enhancer);
|
|
|
|
if (module.hot) {
|
|
module.hot.accept('../reducers', () =>
|
|
store.replaceReducer(require('../reducers').default)
|
|
);
|
|
}
|
|
|
|
return store;
|
|
}
|