-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.jsx
More file actions
26 lines (18 loc) · 733 Bytes
/
Copy pathcreate.jsx
File metadata and controls
26 lines (18 loc) · 733 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
26
import { reduxReactRouter } from 'redux-router';
import useScroll from 'scroll-behavior';
import { createHistory } from 'history';
import { applyMiddleware, compose, createStore as _createStore } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './modules/reducer';
export default function createStore() {
const middleware = applyMiddleware(thunk);
const createHistoryCustom = (options) => useScroll(createHistory({
queryKey: false, ...options,
}));
const createStoreWithMiddleware = compose(
middleware,
reduxReactRouter({ createHistory: createHistoryCustom })
);
const _store = createStoreWithMiddleware(_createStore)(rootReducer);
return _store;
}