Skip to content

Instantly share code, notes, and snippets.

@stepankuzmin
Last active March 11, 2018 09:08
Show Gist options
  • Save stepankuzmin/9bc64a077458d5276926abe9be0d1906 to your computer and use it in GitHub Desktop.
Save stepankuzmin/9bc64a077458d5276926abe9be0d1906 to your computer and use it in GitHub Desktop.
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