mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-02-12 17:40:47 +03:00
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
|
import 'babel-polyfill';
|
||
|
|
||
|
import React from 'react';
|
||
|
import ReactDOM from 'react-dom';
|
||
|
import { createStore, applyMiddleware, compose } from 'redux';
|
||
|
import createSagaMiddleware from 'redux-saga';
|
||
|
// import sagaMonitor from './sagaMonitor'
|
||
|
|
||
|
import Counter from './components/Counter';
|
||
|
import reducer from './reducers';
|
||
|
import rootSaga from './sagas';
|
||
|
|
||
|
const sagaMiddleware = createSagaMiddleware(/* {sagaMonitor} */);
|
||
|
const composeEnhancers =
|
||
|
(window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &&
|
||
|
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
||
|
trace: true,
|
||
|
traceLimit: 25,
|
||
|
})) ||
|
||
|
compose;
|
||
|
const store = createStore(
|
||
|
reducer,
|
||
|
composeEnhancers(applyMiddleware(sagaMiddleware))
|
||
|
);
|
||
|
sagaMiddleware.run(rootSaga);
|
||
|
|
||
|
const action = (type) => store.dispatch({ type });
|
||
|
|
||
|
function render() {
|
||
|
ReactDOM.render(
|
||
|
<Counter
|
||
|
value={store.getState()}
|
||
|
onIncrement={() => action('INCREMENT')}
|
||
|
onDecrement={() => action('DECREMENT')}
|
||
|
onIncrementIfOdd={() => action('INCREMENT_IF_ODD')}
|
||
|
onIncrementAsync={() => action('INCREMENT_ASYNC')}
|
||
|
/>,
|
||
|
document.getElementById('root')
|
||
|
);
|
||
|
}
|
||
|
|
||
|
render();
|
||
|
store.subscribe(render);
|