Skip to content

Instantly share code, notes, and snippets.

@mohandere
Last active February 15, 2018 20:07
Show Gist options
  • Save mohandere/4e734bbc07f728ef51e72e0b8b14ddf6 to your computer and use it in GitHub Desktop.
Save mohandere/4e734bbc07f728ef51e72e0b8b14ddf6 to your computer and use it in GitHub Desktop.
Getting started with create-react-app, Redux, React Router, Redux observable & React Bootstrap(reactstrap)
import { createStore, applyMiddleware } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import createHistory from 'history/createHashHistory';
import { routerMiddleware } from 'react-router-redux';
// import root epic/reducer
import rootEpic from './rootEpic';
import rootReducer from './rootReducer';
import queryString from 'query-string';
// export `history` to use in index.js, we using `createBrowserHistory`
export const history = createHistory();
const epicMiddleware = createEpicMiddleware(rootEpic, {
dependencies: {
queryString
}
});
// Build the middleware for intercepting and dispatching navigation actions
const appRouterMiddleware = routerMiddleware(history);
const store = createStore(rootReducer, applyMiddleware(epicMiddleware), applyMiddleware(appRouterMiddleware));
export default store;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment