mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-27 03:53:55 +03:00
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import React, { Component } from 'react';
|
|
import TodoApp from './TodoApp';
|
|
import { createStore, combineReducers, compose } from 'redux';
|
|
import { devTools, persistState } from 'redux-devtools';
|
|
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
|
|
import { Provider } from 'react-redux';
|
|
import * as reducers from '../reducers';
|
|
|
|
const finalCreateStore = compose(
|
|
devTools(),
|
|
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
|
|
)(createStore);
|
|
|
|
const reducer = combineReducers(reducers);
|
|
const store = finalCreateStore(reducer);
|
|
|
|
if (module.hot) {
|
|
module.hot.accept('../reducers', () =>
|
|
store.replaceReducer(combineReducers(require('../reducers')))
|
|
);
|
|
}
|
|
|
|
export default class App extends Component {
|
|
render() {
|
|
return (
|
|
<div>
|
|
<Provider store={store}>
|
|
{() => <TodoApp /> }
|
|
</Provider>
|
|
<DebugPanel top right bottom>
|
|
<DevTools store={store}
|
|
monitor={LogMonitor}
|
|
visibleOnLoad={true} />
|
|
</DebugPanel>
|
|
</div>
|
|
);
|
|
}
|
|
}
|