Skip to content

Commit 9286731

Browse files
committed
Update README.md
1 parent 706455c commit 9286731

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,29 @@ Redux has no opinion on how you do this in your project.
267267
I wrote a lot of vanilla Flux code, and my only use case for it was avoiding emitting a change before a related Store consumes the action. In Redux this doesn't matter because the change is only emitted after *all* Stores have consumed the action.
268268

269269
If several of your Stores want to read data from each other and depend on each other, it's a sign they should've been a single Store instead. [See this discussion on how `waitFor` can be replaced by the composition of stateless Stores.](https://gist.github.com/gaearon/d77ca812015c0356654f)
270+
271+
### My views aren't updating!
272+
273+
Redux makes a hard assumption that you never mutate the state passed to you. It's easy! For example, instead of
274+
275+
```js
276+
function (state, action) {
277+
state.isAuthenticated = true;
278+
state.email = action.email;
279+
return state;
280+
}
281+
```
282+
283+
you should write
284+
285+
```js
286+
function (state, action) {
287+
return {
288+
...state,
289+
isAuthenticated: true,
290+
email: action.email
291+
};
292+
}
293+
```
294+
295+
[Read more](https://github.com/sebmarkbage/ecmascript-rest-spread) about the spread properties ES7 proposal.

0 commit comments

Comments
 (0)