Skip to content

Commit f24aa20

Browse files
ruggeritimdorr
authored andcommitted
document assertReducerSanity behavior (#1633)
It is not clear from the documentation that it is insufficient to merely avoid ever passing in `undefined` as state by using initial state. `assertReducerSanity` will test that your reducer does the right thing when passed `undefined`, even if you never intend for it to be called this way. This documentation change makes that behavior clearer, in the hopes of saving new users from needless frustration.
1 parent 5fb26a3 commit f24aa20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/api/combineReducers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Any reducer passed to `combineReducers` must satisfy these rules:
4545

4646
* If the `state` given to it is `undefined`, it must return the initial state for this specific reducer. According to the previous rule, the initial state must not be `undefined` either. It is handy to specify it with ES6 optional arguments syntax, but you can also explicitly check the first argument for being `undefined`.
4747

48-
While `combineReducers` attempts to check that your reducers conform to some of these rules, you should remember them, and do your best to follow them.
48+
While `combineReducers` attempts to check that your reducers conform to some of these rules, you should remember them, and do your best to follow them. `combineReducers` will check your reducers by passing `undefined` to them; this is done even if you specify initial state to `Redux.createStore(combinedReducers(...), initialState)`. Therefore, you **must** ensure your reducers work properly when receiving `undefined` as state, even if you never intend for them to actually receive `undefined` in your own code.
4949

5050
#### Example
5151

0 commit comments

Comments
 (0)