forked from reactjs/react-router-redux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request reactjs#70 from geowarin/dev-tools
Add Dev tools
- Loading branch information
Showing
3 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,41 @@ | ||
const React = require('react'); | ||
const ReactDOM = require('react-dom'); | ||
const { createStore, combineReducers } = require('redux'); | ||
const { compose, createStore, combineReducers } = require('redux'); | ||
const { Provider } = require('react-redux'); | ||
const { Router, Route, IndexRoute } = require('react-router'); | ||
const createHistory = require('history/lib/createHashHistory'); | ||
const { syncReduxAndRouter, routeReducer } = require('redux-simple-router'); | ||
import { devTools } from 'redux-devtools'; | ||
const { DevTools, DebugPanel, LogMonitor } = require('redux-devtools/lib/react'); | ||
|
||
const reducers = require('./reducers'); | ||
const { App, Home, Foo, Bar } = require('./components'); | ||
|
||
const reducer = combineReducers(Object.assign({}, reducers, { | ||
routing: routeReducer | ||
})); | ||
const store = createStore(reducer); | ||
const finalCreateStore = compose( | ||
devTools() | ||
)(createStore); | ||
const store = finalCreateStore(reducer); | ||
const history = createHistory(); | ||
|
||
syncReduxAndRouter(history, store); | ||
|
||
ReactDOM.render( | ||
<Provider store={store}> | ||
<Router history={history}> | ||
<Route path="/" component={App}> | ||
<IndexRoute component={Home}/> | ||
<Route path="foo" component={Foo}/> | ||
<Route path="bar" component={Bar}/> | ||
</Route> | ||
</Router> | ||
<div> | ||
<Router history={history}> | ||
<Route path="/" component={App}> | ||
<IndexRoute component={Home}/> | ||
<Route path="foo" component={Foo}/> | ||
<Route path="bar" component={Bar}/> | ||
</Route> | ||
</Router> | ||
<DebugPanel top right bottom> | ||
<DevTools store={store} monitor={LogMonitor} /> | ||
</DebugPanel> | ||
</div> | ||
</Provider>, | ||
document.getElementById('mount') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters