-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (25 loc) · 896 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import { createStore, applyMiddleware } from 'redux';
import articalApp from './reducers'
import { Provider } from 'react-redux'
import { requestArticles } from './actions/index';
import createSagaMiddleware from 'redux-saga'
import rootSaga from './middleware/articleMiddleware'
const sagaMiddleware = createSagaMiddleware();
let store = createStore(
articalApp,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
applyMiddleware(sagaMiddleware)
);
sagaMiddleware.run(rootSaga);
ReactDOM.render(
<Provider store = {store}>
<App onFetchArticles={() => store.dispatch(requestArticles())}/>
</Provider>,
document.getElementById('root')
);
registerServiceWorker();