Skip to content

Commit e2dfa46

Browse files
committed
Minor help text improvements
1 parent f8359b2 commit e2dfa46

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/recipes/ReducingBoilerplate.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const LOAD_ARTICLE = 'LOAD_ARTICLE';
2828

2929
Why is this beneficial? **It is often claimed that constants are unnecessary, and for small projects, this might be correct.** For larger projects, there are some benefits to defining action types as constants:
3030

31-
* It helps maintain the naming consistent because all action types are gathered in a single place.
32-
* Sometimes you want to see all existing actions before working on a new feature. It happens that the action you needed was already added by somebody on the team, but you didn’t know.
31+
* It helps keep the naming consistent because all action types are gathered in a single place.
32+
* Sometimes you want to see all existing actions before working on a new feature. It may be that the action you need was already added by somebody on the team, but you didn’t know.
3333
* The list of action types that were added, removed, and changed in a Pull Request, helps everyone on the team keep track of scope and implementation of new features.
3434
* If you make a typo when importing an action constant, you will get `undefined`. This is much easier to notice than a typo when you wonder why nothing happens when the action is dispatched.
3535

@@ -141,11 +141,11 @@ export const removeTodo = makeActionCreator('REMOVE_TODO', 'id');
141141
See [redux-action-utils](https://github.com/insin/redux-action-utils) and [redux-actions](https://github.com/acdlite/redux-actions) for examples of such utilities.
142142

143143
Note that such utilities add magic to your code.
144-
Are magic and indirection really worth extra few lines?
144+
Are magic and indirection really worth it to avoid a few extra few lines of code?
145145

146146
## Async Action Creators
147147

148-
[Middleware](../Glossary.html#middleware) lets you inject a custom logic that interprets every action object before it is dispatched. Async actions are the most common use case for middleware.
148+
[Middleware](../Glossary.html#middleware) lets you inject custom logic that interprets every action object before it is dispatched. Async actions are the most common use case for middleware.
149149

150150
Without any middleware, [`dispatch`](../api/Store.md#dispatch) only accepts a plain object, so we have to perform AJAX calls inside our components:
151151

@@ -232,7 +232,7 @@ export default connect(state => ({
232232
}))(Posts);
233233
```
234234

235-
However, this quickly gets repetitive because different components request data from the same API endpoints. Moreover, we want to reuse some of this logic (e.g. early exit when there is cached data available) from many components.
235+
However, this quickly gets repetitive because different components request data from the same API endpoints. Moreover, we want to reuse some of this logic (e.g., early exit when there is cached data available) from many components.
236236

237237
**Middleware lets us write more expressive, potentially async action creators.** It lets us dispatch something other than plain objects, and interprets the values. For example, middleware can “catch” dispatched Promises and turn them into a pair of request and success/failure actions.
238238

@@ -470,7 +470,7 @@ It’s unfortunate that many still choose Flux framework based on whether it use
470470

471471
### Generating Reducers
472472

473-
Let’s write a function that lets us express reducers as object mapping from action types to handlers. For example, if we want our `todos` reducers to be defined like this:
473+
Let’s write a function that lets us express reducers as an object mapping from action types to handlers. For example, if we want our `todos` reducers to be defined like this:
474474

475475
```js
476476
export const todos = createReducer([], {
@@ -495,6 +495,6 @@ function createReducer(initialState, handlers) {
495495
}
496496
```
497497
498-
This wasn’t difficult, was it? Redux doesn’t provide such helper by default because there are many ways to write it. Maybe you want it to automatically convert plain JS objects to Immutable objects to hydrate the server state. Maybe you want to merge the returned state with the current state. There may be different approaches to “catch all” handler. All of this depends on the conventions you choose for your team on a specific project.
498+
This wasn’t difficult, was it? Redux doesn’t provide such a helper function by default because there are many ways to write it. Maybe you want it to automatically convert plain JS objects to Immutable objects to hydrate the server state. Maybe you want to merge the returned state with the current state. There may be different approaches to a “catch all” handler. All of this depends on the conventions you choose for your team on a specific project.
499499
500500
Redux reducer API is `(state, action) => state`, but how you create those reducers is up to you.

0 commit comments

Comments
 (0)