Skip to content

Commit af381c1

Browse files
committed
Merge pull request reduxjs#755 from camsong/patch-2
Update AsyncActions.md, fix code indentation
2 parents ae1816f + 439fef5 commit af381c1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/advanced/AsyncActions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,17 @@ In this code, there are two interesting parts:
275275

276276
* We use ES6 computed property syntax so we can update `state[action.reddit]` with `Object.assign()` in a terse way. This:
277277

278-
```js
279-
return Object.assign({}, state, {
280-
[action.reddit]: posts(state[action.reddit], action)
281-
});
282-
```
278+
```js
279+
return Object.assign({}, state, {
280+
[action.reddit]: posts(state[action.reddit], action)
281+
});
282+
```
283283
is equivalent to this:
284284

285285
```js
286-
let nextState = {};
287-
nextState[action.reddit] = posts(state[action.reddit], action);
288-
return Object.assign({}, state, nextState);
286+
let nextState = {};
287+
nextState[action.reddit] = posts(state[action.reddit], action);
288+
return Object.assign({}, state, nextState);
289289
```
290290
* We extracted `posts(state, action)` that manages the state of a specific post list. This is just [reducer composition](../basics/Reducers.md#splitting-reducers)! It is our choice how to split the reducer into smaller reducers, and in this case, we’re delegating updating items inside an object to a `posts` reducer. The [real world example](../introduction/Examples.html#real-world) goes even further, showing how to create a reducer factory for parameterized pagination reducers.
291291

0 commit comments

Comments
 (0)