2015-07-14 22:46:44 +03:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import CounterApp from './CounterApp';
|
2015-07-15 00:11:55 +03:00
|
|
|
import { createStore, applyMiddleware, 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 thunk from 'redux-thunk';
|
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import * as reducers from '../reducers';
|
|
|
|
|
2015-07-15 00:11:55 +03:00
|
|
|
const finalCreateStore = compose(
|
|
|
|
applyMiddleware(thunk),
|
|
|
|
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:11:55 +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:11:55 +03:00
|
|
|
<div>
|
|
|
|
<Provider store={store}>
|
|
|
|
{() => <CounterApp />}
|
|
|
|
</Provider>
|
|
|
|
<DebugPanel top right bottom>
|
|
|
|
<DevTools store={store}
|
|
|
|
monitor={LogMonitor} />
|
|
|
|
</DebugPanel>
|
|
|
|
</div>
|
2015-07-14 22:46:44 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|