You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -267,3 +267,29 @@ Redux has no opinion on how you do this in your project.
267
267
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.
268
268
269
269
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