forked from lo-th/Oimo.js
-
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 lo-th#1 from qnm/master
Add react-devtools
- Loading branch information
Showing
2 changed files
with
19 additions
and
4 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,18 +1,32 @@ | ||
import React, { Component } from 'react'; | ||
import PokedexApp from './PokedexApp'; | ||
import { createStore, combineReducers } from 'redux'; | ||
import { createStore, combineReducers, compose } from 'redux'; | ||
import { Provider } from 'react-redux'; | ||
import * as reducers from '../reducers'; | ||
import { devTools, persistState } from 'redux-devtools'; | ||
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react'; | ||
|
||
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 ( | ||
<Provider store={store}> | ||
<div> | ||
<Provider store={store}> | ||
{() => <PokedexApp />} | ||
</Provider> | ||
</Provider> | ||
<DebugPanel top right bottom> | ||
<DevTools store={store} | ||
monitor={LogMonitor} /> | ||
</DebugPanel> | ||
</div> | ||
); | ||
} | ||
} |
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