Skip to content

Commit

Permalink
Clarify combineReducers() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Dec 22, 2015
1 parent e1b2a95 commit ec0b1a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/api/combineReducers.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ The resulting reducer calls every child reducer, and gather their results into a
Consequently, the state object will look like this :

```
state : {
{
reducer1: ...
reducer2: ...
}
```

You can control state key names by using different keys for the reducers in the passed object. For example, you may call `combineReducers({ todos: myTodosReducer, counter: myCounterReducer })` for the state shape to be `{ todos, counter }`.

A popular convention is to name reducers after the state slices they manage, so you can use ES6 property shorthand notation: `combineReducers({ counter, todos })`. This is equivalent to writing `combineReducers({ counter: counter, todos: todos })`.

> ##### A Note for Flux Users
> This function helps you organize your reducers to manage their own slices of state, similar to how you would have different Flux Stores to manage different state. With Redux, there is just one store, but `combineReducers` helps you keep the same logical division between reducers.
Expand Down

0 comments on commit ec0b1a3

Please sign in to comment.