Created
July 11, 2018 16:44
-
-
Save itto-ki/ced49142b1051759a64602b4a88d60b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import ReactDOM from 'react-dom' | |
import { Provider } from 'react-redux' | |
import { compose, createStore, applyMiddleware } from 'redux' | |
import { createBrowserHistory } from 'history' | |
import { connectRouter, routerMiddleware } from 'connected-react-router' | |
import createSagaMiddleware from 'redux-saga' | |
import rootReducer from './reducers' | |
import App from './components/App' | |
import apiSaga from './sagas/saga' | |
// Middlewareの作成 | |
const sagaMiddleware = createSagaMiddleware() | |
const history = createBrowserHistory(); | |
const hisotryMiddleware = routerMiddleware(history); | |
const store = createStore( | |
connectRouter(history)(rootReducer), | |
compose( | |
applyMiddleware( | |
sagaMiddleware, | |
hisotryMiddleware | |
), | |
), | |
) | |
sagaMiddleware.run(apiSaga) | |
ReactDOM.render( | |
<Provider store={store}> | |
<App history={history} /> | |
</Provider>, | |
document.getElementById('root') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment