redux-devtools/examples/todomvc/containers/App.js

33 lines
911 B
JavaScript
Raw Normal View History

2015-07-14 22:46:44 +03:00
import React, { Component } from 'react';
import TodoApp from './TodoApp';
2015-07-15 00:25:02 +03:00
import { createStore, combineReducers, compose } from 'redux';
import { devTools, persistState } from 'redux-devtools';
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
2015-07-14 22:46:44 +03:00
import { Provider } from 'react-redux';
import * as reducers from '../reducers';
2015-07-15 00:25:02 +03:00
const finalCreateStore = compose(
devTools(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)),
createStore
);
2015-07-14 22:46:44 +03:00
const reducer = combineReducers(reducers);
2015-07-15 00:25:02 +03:00
const store = finalCreateStore(reducer);
2015-07-14 22:46:44 +03:00
export default class App extends Component {
render() {
return (
2015-07-15 00:25:02 +03:00
<div>
<Provider store={store}>
{() => <TodoApp /> }
</Provider>
<DebugPanel top right bottom>
<DevTools store={store}
monitor={LogMonitor} />
</DebugPanel>
</div>
2015-07-14 22:46:44 +03:00
);
}
}