spee.ch/react/index.js

25 lines
652 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);
const enhancer = window.__REDUX_DEVTOOLS_EXTENSION__ ? compose(middleware, window.__REDUX_DEVTOOLS_EXTENSION__()) : middleware;
2018-01-29 20:47:12 +01:00
let store = createStore(
Reducer,
enhancer,
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
);