mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-22 09:36:43 +03:00
Add monitor to TodoMVC
This commit is contained in:
parent
38e6184f44
commit
72301fb741
|
@ -1,18 +1,32 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import TodoApp from './TodoApp';
|
import TodoApp from './TodoApp';
|
||||||
import { createStore, combineReducers } from 'redux';
|
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 { Provider } from 'react-redux';
|
||||||
import * as reducers from '../reducers';
|
import * as reducers from '../reducers';
|
||||||
|
|
||||||
|
const finalCreateStore = compose(
|
||||||
|
devTools(),
|
||||||
|
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)),
|
||||||
|
createStore
|
||||||
|
);
|
||||||
|
|
||||||
const reducer = combineReducers(reducers);
|
const reducer = combineReducers(reducers);
|
||||||
const store = createStore(reducer);
|
const store = finalCreateStore(reducer);
|
||||||
|
|
||||||
export default class App extends Component {
|
export default class App extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Provider store={store}>
|
<div>
|
||||||
{() => <TodoApp /> }
|
<Provider store={store}>
|
||||||
</Provider>
|
{() => <TodoApp /> }
|
||||||
|
</Provider>
|
||||||
|
<DebugPanel top right bottom>
|
||||||
|
<DevTools store={store}
|
||||||
|
monitor={LogMonitor} />
|
||||||
|
</DebugPanel>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ module.exports = {
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'redux-devtools': path.join(__dirname, '..', '..', 'src')
|
'redux-devtools/lib': path.join(__dirname, '..', '..', 'src'),
|
||||||
|
'redux-devtools': path.join(__dirname, '..', '..', 'src'),
|
||||||
|
'react': path.join(__dirname, 'node_modules', 'react')
|
||||||
},
|
},
|
||||||
extensions: ['', '.js']
|
extensions: ['', '.js']
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user