spee.ch/react/index.js

23 lines
612 B
JavaScript
Raw Normal View History

2018-01-29 20:47:12 +01:00
import React from 'react';
import { render } from 'react-dom';
2018-02-07 04:00:52 +01:00
import { createStore, applyMiddleware, compose } from 'redux';
2018-01-29 20:47:12 +01:00
import Reducer from 'reducers';
2018-02-07 04:00:52 +01:00
import createSagaMiddleware from 'redux-saga';
import rootSaga from 'sagas';
2018-01-29 20:47:12 +01:00
import Root from './root';
2018-02-07 04:00:52 +01:00
const sagaMiddleware = createSagaMiddleware();
const middleware = applyMiddleware(sagaMiddleware);
2018-01-29 20:47:12 +01:00
let store = createStore(
Reducer,
2018-02-07 04:00:52 +01:00
compose(middleware, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()),
2018-01-29 20:47:12 +01:00
);
2018-02-07 04:00:52 +01:00
sagaMiddleware.run(rootSaga);
2018-01-29 20:47:12 +01:00
render(
<Root store={store} />,
document.getElementById('react-app')
2018-01-29 21:49:01 +01:00
);