Skip to content

Commit 650f002

Browse files
committed
Remove combineReducers shortcut in favor of an explicit call
1 parent 60b2119 commit 650f002

File tree

5 files changed

+204
-237
lines changed

5 files changed

+204
-237
lines changed

examples/counter/containers/App.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import CounterApp from './CounterApp';
3-
import { createStore, applyMiddleware } from 'redux';
3+
import { createStore, applyMiddleware, combineReducers } from 'redux';
44
import { Provider } from 'react-redux';
55
import * as reducers from '../reducers';
66

@@ -13,7 +13,8 @@ function thunk({ dispatch, getState }) {
1313
}
1414

1515
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
16-
const store = createStoreWithMiddleware(reducers);
16+
const reducer = combineReducers(reducers);
17+
const store = createStoreWithMiddleware(reducer);
1718

1819
export default class App {
1920
render() {

examples/todomvc/containers/App.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react';
22
import TodoApp from './TodoApp';
3-
import { createStore } from 'redux';
3+
import { createStore, combineReducers } from 'redux';
44
import { Provider } from 'react-redux';
55
import * as reducers from '../reducers';
66

7-
const store = createStore(reducers);
7+
const reducer = combineReducers(reducers);
8+
const store = createStore(reducer);
89

910
export default class App {
1011
render() {

src/createStore.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
import Store from './Store';
2-
import combineReducers from './utils/combineReducers';
32

4-
export default function createStore(
5-
reducer,
6-
initialState
7-
) {
8-
const finalReducer = typeof reducer === 'function' ?
9-
reducer :
10-
combineReducers(reducer);
11-
12-
const store = new Store(finalReducer, initialState);
3+
export default function createStore(reducer, initialState) {
4+
const store = new Store(reducer, initialState);
135

146
return {
157
dispatch: ::store.dispatch,

test/Store.spec.js

Lines changed: 0 additions & 209 deletions
This file was deleted.

0 commit comments

Comments
 (0)