Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

Commit fe7487a

Browse files
committed
Merge pull request #70 from geowarin/dev-tools
Add Dev tools
2 parents 8422f9f + fafe07a commit fe7487a

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

examples/basic/app.js

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
const React = require('react');
22
const ReactDOM = require('react-dom');
3-
const { createStore, combineReducers } = require('redux');
3+
const { compose, createStore, combineReducers } = require('redux');
44
const { Provider } = require('react-redux');
55
const { Router, Route, IndexRoute } = require('react-router');
66
const createHistory = require('history/lib/createHashHistory');
77
const { syncReduxAndRouter, routeReducer } = require('redux-simple-router');
8+
import { devTools } from 'redux-devtools';
9+
const { DevTools, DebugPanel, LogMonitor } = require('redux-devtools/lib/react');
810

911
const reducers = require('./reducers');
1012
const { App, Home, Foo, Bar } = require('./components');
1113

1214
const reducer = combineReducers(Object.assign({}, reducers, {
1315
routing: routeReducer
1416
}));
15-
const store = createStore(reducer);
17+
const finalCreateStore = compose(
18+
devTools()
19+
)(createStore);
20+
const store = finalCreateStore(reducer);
1621
const history = createHistory();
1722

1823
syncReduxAndRouter(history, store);
1924

2025
ReactDOM.render(
2126
<Provider store={store}>
22-
<Router history={history}>
23-
<Route path="/" component={App}>
24-
<IndexRoute component={Home}/>
25-
<Route path="foo" component={Foo}/>
26-
<Route path="bar" component={Bar}/>
27-
</Route>
28-
</Router>
27+
<div>
28+
<Router history={history}>
29+
<Route path="/" component={App}>
30+
<IndexRoute component={Home}/>
31+
<Route path="foo" component={Foo}/>
32+
<Route path="bar" component={Bar}/>
33+
</Route>
34+
</Router>
35+
<DebugPanel top right bottom>
36+
<DevTools store={store} monitor={LogMonitor} />
37+
</DebugPanel>
38+
</div>
2939
</Provider>,
3040
document.getElementById('mount')
3141
);

examples/basic/components/App.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const React = require('react');
22
const { Link } = require('react-router');
33
const { connect } = require('react-redux');
4-
const { updatePath } = require('redux-simple-router');
4+
const { pushPath } = require('redux-simple-router');
55

6-
function App({ updatePath, children }) {
6+
function App({ pushPath, children }) {
77
return (
88
<div>
99
<header>
@@ -16,7 +16,7 @@ function App({ updatePath, children }) {
1616
<Link to="/bar">Bar</Link>
1717
</header>
1818
<div>
19-
<button onClick={() => updatePath('/foo')}>Go to /foo</button>
19+
<button onClick={() => pushPath('/foo')}>Go to /foo</button>
2020
</div>
2121
<div style={{marginTop: '1.5em'}}>{children}</div>
2222
</div>
@@ -25,5 +25,5 @@ function App({ updatePath, children }) {
2525

2626
module.exports = connect(
2727
null,
28-
{ updatePath }
28+
{ pushPath }
2929
)(App);

examples/basic/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"babel-loader": "^6.2.0",
1616
"babel-preset-es2015": "^6.1.18",
1717
"babel-preset-react": "^6.1.18",
18+
"redux-devtools": "^2.1.5",
1819
"webpack": "^1.12.6"
20+
},
21+
"scripts": {
22+
"start": "webpack --watch"
1923
}
2024
}

0 commit comments

Comments
 (0)