Skip to content

Commit 62fe355

Browse files
committed
update reducer
1 parent 44f6ddc commit 62fe355

File tree

4 files changed

+34
-41
lines changed

4 files changed

+34
-41
lines changed

docs/public/assets/bundle.js

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/redux/modules/reducers.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
import { routerReducer } from 'react-router-redux';
2+
import { combineReducers } from 'redux';
13
import views from './views';
24

3-
export {
5+
export const reducers = {
46
views
57
};
8+
9+
10+
export default combineReducers({
11+
...reducers,
12+
routing: routerReducer
13+
});

src/app/redux/store/configureStore.dev.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { createStore, compose, combineReducers, applyMiddleware } from 'redux';
1+
import { createStore, compose, applyMiddleware } from 'redux';
22
import { persistState } from 'redux-devtools';
3-
import { routerReducer } from 'react-router-redux';
3+
// import { routerReducer } from 'react-router-redux';
44
import createLogger from 'redux-logger';
55
import thunkMiddleware from 'redux-thunk';
6-
import * as reducers from '../modules/reducers';
6+
import reducer from '../modules/reducers';
77
import DevTools from '../devTools/DevTools.jsx';
88

99

@@ -24,15 +24,8 @@ function getDebugSessionKey() {
2424
return (matches && matches.length > 0)? matches[1] : null;
2525
}
2626

27-
// combine reducers -> createStore reducer
28-
const reducer = combineReducers({
29-
...reducers,
30-
routing: routerReducer
31-
});
32-
3327
export default function configureStore(initialState) {
3428
const store = createStore(reducer, initialState, enhancer);
35-
// checks if webpack HMR:
3629
if (module.hot) {
3730
module.hot.accept('../modules/reducers', () =>
3831
store.replaceReducer(require('../modules/reducers').default)
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import {
22
createStore,
33
applyMiddleware,
4-
compose,
5-
combineReducers
4+
compose
65
} from 'redux';
76
import createLogger from 'redux-logger';
87
import thunkMiddleware from 'redux-thunk';
9-
import * as reducers from '../modules/reducers';
10-
import { routerReducer } from 'react-router-redux';
8+
import reducer from '../modules/reducers';
119

1210
const loggerMiddleware = createLogger({
1311
level : 'info',
@@ -19,12 +17,6 @@ const enhancer = compose(
1917
applyMiddleware(thunkMiddleware, loggerMiddleware) // logger after thunk to avoid undefined actions
2018
);
2119

22-
// combine reducers
23-
const reducer = combineReducers({
24-
...reducers,
25-
routing: routerReducer
26-
});
27-
2820
export default function configureStore(initialState) {
2921
return createStore(reducer, initialState, enhancer);
3022
}

0 commit comments

Comments
 (0)