2020-10-26 15:18:23 +03:00
|
|
|
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,
|
2023-07-12 21:03:20 +03:00
|
|
|
composeEnhancers(applyMiddleware(sagaMiddleware)),
|
2020-10-26 15:18:23 +03:00
|
|
|
);
|
|
|
|
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')}
|
|
|
|
/>,
|
2023-07-12 21:03:20 +03:00
|
|
|
document.getElementById('root'),
|
2020-10-26 15:18:23 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
render();
|
|
|
|
store.subscribe(render);
|