Skip to content

Commit d4bb97b

Browse files
committed
flip failure and success types
1 parent 1c3d364 commit d4bb97b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/advanced/AsyncActions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Even if you call an asynchronous API, you need to dispatch actions to change the
1919
The reducers may handle this action by merging the new data into the state they manage and resetting `isFetching`. The UI would hide the spinner, and display the fetched data.
2020

2121
* **An action informing the reducers that the request failed.**
22-
22+
2323
The reducers may handle this action by resetting `isFetching`. Maybe, some reducers will also want to store the error message so the UI can display it.
2424

2525
You may use a dedicated `status` field in your actions:
@@ -34,8 +34,8 @@ Or you can define separate types for them:
3434

3535
```js
3636
{ type: 'FETCH_POSTS_REQUEST' }
37-
{ type: 'FETCH_POSTS_SUCCESS', error: 'Oops' }
38-
{ type: 'FETCH_POSTS_FAILURE', response: { ... } }
37+
{ type: 'FETCH_POSTS_FAILURE', error: 'Oops' }
38+
{ type: 'FETCH_POSTS_SUCCESS', response: { ... } }
3939
```
4040

4141
Choosing whether to use a single action type with flags, or multiple action types, is up to you. It’s a convention you need to decide with your team. Multiple types leave less room for a mistake, but this is not an issue if you generate action creators and reducers with a helper library like [redux-actions](https://github.com/acdlite/redux-actions).

0 commit comments

Comments
 (0)