Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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