From 72301fb74154049f39db204d1de4ddf9bb06cb9d Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 15 Jul 2015 00:25:02 +0300 Subject: [PATCH] Add monitor to TodoMVC --- examples/todomvc/containers/App.js | 24 +++++++++++++++++++----- examples/todomvc/webpack.config.js | 4 +++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/examples/todomvc/containers/App.js b/examples/todomvc/containers/App.js index 49c8f93b..dc7e34ad 100644 --- a/examples/todomvc/containers/App.js +++ b/examples/todomvc/containers/App.js @@ -1,18 +1,32 @@ import React, { Component } from 'react'; 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 * as reducers from '../reducers'; +const finalCreateStore = compose( + devTools(), + persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)), + createStore +); + const reducer = combineReducers(reducers); -const store = createStore(reducer); +const store = finalCreateStore(reducer); export default class App extends Component { render() { return ( - - {() => } - +
+ + {() => } + + + + +
); } } diff --git a/examples/todomvc/webpack.config.js b/examples/todomvc/webpack.config.js index 4022d298..6f10fe92 100644 --- a/examples/todomvc/webpack.config.js +++ b/examples/todomvc/webpack.config.js @@ -19,7 +19,9 @@ module.exports = { ], resolve: { 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'] },