Skip to content

Commit bc7fce1

Browse files
committed
Merge pull request reduxjs#708 from quamen/fix-syntax-error-in-advanced-async-actions-doc
Remove semi-colon from sample code
2 parents 90f6d83 + 5ceb2e7 commit bc7fce1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/advanced/AsyncActions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ Remember that reducers are just functions, so you can use functional composition
294294
## Async Action Creators
295295

296296
Finally, how do we use the synchronous action creators we [defined earlier](#synchronous-action-creators) together with network requests? The standard way to do it with Redux is to use the [Redux Thunk middleware](https://github.com/gaearon/redux-thunk). It comes in a separate package called `redux-thunk`. We’ll explain how middleware works in general [later](Middleware.md); for now, there is just one important thing you need to know: by using this specific middleware, an action creator can return a function instead an action object. This way, the function creator becomes a [thunk](https://en.wikipedia.org/wiki/Thunk).
297-
297+
298298
When a function creator returns a function, that function will get executed by the Redux Thunk middleware. This function doesn’t need to be pure; it is thus allowed to have side effects, including executing asynchronous API calls. The function can also dispatch actions—like those synchronous actions we defined earlier.
299299

300300
We can still define these special thunk action creators inside our `actions.js` file:
@@ -399,7 +399,7 @@ const store = createStoreWithMiddleware(rootReducer);
399399

400400
store.dispatch(selectReddit('reactjs'));
401401
store.dispatch(fetchPosts('reactjs')).then(() =>
402-
console.log(store.getState());
402+
console.log(store.getState())
403403
);
404404
```
405405

0 commit comments

Comments
 (0)