Skip to content

Commit e009437

Browse files
committed
Minor help text improvements
1 parent c1e62b6 commit e009437

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/advanced/Middleware.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Middleware
22

3-
If you used server-side libraries like [Express](http://expressjs.com/) and [Koa](http://koajs.com/), you are familiar with a concept of *middleware*. In these frameworks, middleware is some code you can put between the framework receiving a request, and framework generating a response. For example, Express or Koa middleware may add CORS headers, logging, compression, and more. The best feature of middleware is that it’s composable in a chain. You can use multiple independent third-party middleware in a single project.
3+
If you've used server-side libraries like [Express](http://expressjs.com/) and [Koa](http://koajs.com/), you are familiar with a concept of *middleware*. In these frameworks, middleware is some code you can put between the framework receiving a request, and framework generating a response. For example, Express or Koa middleware may add CORS headers, logging, compression, and more. The best feature of middleware is that it’s composable in a chain. You can use multiple independent third-party middleware in a single project.
44

55
Redux middleware solves different problems than Express or Koa middleware, but in a conceptually similar way. **It provides a third-party extension point between dispatching an action, and the moment it reaches the store.** People use Redux middleware for logging, crash reporting, talking to an asynchronous API, routing, and more.
66

7-
This article is divided in an in-depth intro to help you grok the concept, and [a few practical examples](#seven-examples) to show the power of middleware at the very end. You may find it helpful to switch back and forth between them, as you flip between feeling bored and inspired.
7+
This article is divided into an in-depth intro to help you grok the concept, and [a few practical examples](#seven-examples) to show the power of middleware at the very end. You may find it helpful to switch back and forth between them, as you flip between feeling bored and inspired.
88

99
>##### Note for the Impatient
1010
11-
>You will find some practical advice on using middleware for asynchronous actions [in the next section](AsyncActions.md). However we strongly advise you to resist the urge to skip this article.
11+
>You will find some practical advice on using middleware for asynchronous actions [in the next section](AsyncActions.md). However we strongly advise you to resist the urge to skip this section.
1212
1313
>Middleware is the most “magical” part of Redux you are likely to encounter. Learning how it works and how to write your own is the best investment you can make into your productivity using Redux.
1414
@@ -76,7 +76,7 @@ We could end this here, but it’s not very convenient to import a special funct
7676

7777
### Attempt #3: Monkeypatching Dispatch
7878

79-
What if we just replace the `dispatch` function on the store instance? Redux store is just a plain object with [a few methods](../api/Store.md), and we’re writing JavaScript, so we can just monkeypatch the `dispatch` implementation:
79+
What if we just replace the `dispatch` function on the store instance? The Redux store is just a plain object with [a few methods](../api/Store.md), and we’re writing JavaScript, so we can just monkeypatch the `dispatch` implementation:
8080

8181
```js
8282
let next = store.dispatch;
@@ -92,7 +92,7 @@ This is already closer to what we want! No matter where we dispatch an action,
9292

9393
### Problem: Crash Reporting
9494

95-
What if we want to apply **more then one** such transformation to `dispatch`?
95+
What if we want to apply **more than one** such transformation to `dispatch`?
9696

9797
A different useful transformation that comes to my mind is reporting JavaScript errors in production. The global `window.onerror` event is not reliable because it doesn’t provide stack information in some older browsers, which is crucial to understand why an error is happening.
9898

@@ -274,7 +274,7 @@ function applyMiddleware(store, middlewares) {
274274

275275
The implementation of [`applyMiddleware()`](../api/applyMiddleware.md) that ships with Redux is similar, but **different in three important aspects**:
276276

277-
* It only exposes a subset of [store API](../api/Store.md) to the middleware: [`dispatch(action)`](../api/Store.md#dispatch) and [`getState()`](../api/Store.
277+
* It only exposes a subset of the [store API](../api/Store.md) to the middleware: [`dispatch(action)`](../api/Store.md#dispatch) and [`getState()`](../api/Store.
278278
md#getState).
279279

280280
* It does a bit of trickery to make sure that if you call `store.dispatch(action)` from your middleware instead of `next(action)`, the action will actually travel the whole middleware chain again, including the current middleware. This is useful for asynchronous middleware, as we will see [later](AsyncActions.md).
@@ -326,7 +326,7 @@ let todoApp = combineReducers(reducers);
326326
let store = createStoreWithMiddleware(todoApp);
327327
```
328328

329-
This is it! Now any actions dispatched to the store instance will flow through `logger` and `crashReporter`:
329+
That's it! Now any actions dispatched to the store instance will flow through `logger` and `crashReporter`:
330330

331331
```js
332332
// Will flow through both logger and crashReporter middleware!
@@ -335,7 +335,7 @@ store.dispatch(addTodo('Use Redux'));
335335

336336
## Seven Examples
337337

338-
If your head boiled from reading the above section, imagine what it was like to write it. This part is meant to be a relaxation for you and me, and will help get your gears turning.
338+
If your head boiled from reading the above section, imagine what it was like to write it. This section is meant to be a relaxation for you and me, and will help get your gears turning.
339339

340340
Each function below is a valid Redux middleware. They are not equally useful, but at least they are equally fun.
341341

0 commit comments

Comments
 (0)