-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (21 loc) · 991 Bytes
/
index.js
File metadata and controls
25 lines (21 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// @flow
// Create final store using all reducers and applying middleware
import { createBrowserHistory } from 'history';
// Redux utility functions
import { compose, createStore, combineReducers, applyMiddleware } from 'redux';
import { routerMiddleware, connectRouter } from 'connected-react-router';
// Import all reducers
import * as reducers from 'reducers/index';
// Configure reducer to store state at state.router
// You can store it elsewhere by specifying a custom `routerStateSelector`
// in the store enhancer below
export const history = createBrowserHistory();
const reducer = combineReducers({ ...reducers });
const store = compose(
// Enables your middleware:
// applyMiddleware(thunk), // any Redux middleware, e.g. redux-thunk
applyMiddleware(routerMiddleware(history)),
// Provides support for DevTools via Chrome extension
window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore)(connectRouter(history)(reducer));
export default store;