mirror of
				https://github.com/reduxjs/redux-devtools.git
				synced 2025-10-31 07:57:39 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			995 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			995 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import React, { Component } from 'react';
 | |
| import CounterApp from './CounterApp';
 | |
| import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
 | |
| import { devTools, persistState } from 'redux-devtools';
 | |
| import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
 | |
| import thunk from 'redux-thunk';
 | |
| import { Provider } from 'react-redux';
 | |
| import * as reducers from '../reducers';
 | |
| 
 | |
| const finalCreateStore = compose(
 | |
|   applyMiddleware(thunk),
 | |
|   devTools(),
 | |
|   persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)),
 | |
|   createStore
 | |
| );
 | |
| 
 | |
| const reducer = combineReducers(reducers);
 | |
| const store = finalCreateStore(reducer);
 | |
| 
 | |
| export default class App extends Component {
 | |
|   render() {
 | |
|     return (
 | |
|       <div>
 | |
|         <Provider store={store}>
 | |
|           {() => <CounterApp />}
 | |
|         </Provider>
 | |
|         <DebugPanel top right bottom>
 | |
|           <DevTools store={store}
 | |
|                     monitor={LogMonitor} />
 | |
|         </DebugPanel>
 | |
|       </div>
 | |
|     );
 | |
|   }
 | |
| }
 |