Skip to content

Instantly share code, notes, and snippets.

@itto-ki
Created July 11, 2018 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itto-ki/ced49142b1051759a64602b4a88d60b3 to your computer and use it in GitHub Desktop.
Save itto-ki/ced49142b1051759a64602b4a88d60b3 to your computer and use it in GitHub Desktop.
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