Last active
March 11, 2018 09:08
-
-
Save stepankuzmin/9bc64a077458d5276926abe9be0d1906 to your computer and use it in GitHub Desktop.
authentication with react-router-redux 5.x and redux-saga https://medium.com/@stepankuzmin/authentication-with-react-router-redux-5-x-and-redux-saga-55da66b54be7
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 createHistory from 'history/createBrowserHistory'; | |
import createSagaMiddleware from 'redux-saga'; | |
import { Provider } from 'react-redux'; | |
import { routerMiddleware } from 'react-router-redux'; | |
import { applyMiddleware, createStore } from 'redux'; | |
import App from './App'; | |
import Saga from './saga'; | |
import reducer from './reducer'; | |
// create middlewares | |
const history = createHistory(); | |
const sagaMiddleware = createSagaMiddleware(); | |
const middleware = applyMiddleware( | |
routerMiddleware(history), | |
sagaMiddleware | |
); | |
// create store | |
const store = createStore(reducer, middleware); | |
// run saga middleware | |
sagaMiddleware.run(Saga); | |
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