Skip to content

Commit 7cf5b58

Browse files
committed
Wordsmithing
1 parent 7ced9ce commit 7cf5b58

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

content/blog/2018-03-27-update-on-async-rendering.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ These lifecycle methods have often been misunderstood and subtly misused; furthe
2323

2424
**Note that if you're an application developer, you don't have to do anything about the legacy methods yet. The primary purpose of the upcoming version 16.3 release is to enable open source project maintainers to update their libraries in advance of any deprecation warnings. Those warnings will not be enabled until a future 16.x release.**
2525

26-
At Facebook, we maintain over 50,000 React components, so we're in the same boat as you. We can't rewrite our apps so we will take the gradual migration path together with everyone in the React community.
26+
We maintain over 50,000 React components at Facebook, so we understand that migrations take time. We will take the gradual migration path together with everyone in the React community.
2727

2828
---
2929

@@ -88,7 +88,7 @@ There is a common misconception that fetching in `componentWillMount` lets you a
8888
>
8989
> Some advanced use-cases (e.g. libraries like Relay) may want to experiment with eagerly prefetching async data. An example of how this can be done is available [here](https://gist.github.com/bvaughn/89700e525ff423a75ffb63b1b1e30a8f).
9090
>
91-
> In the longer term, the canonical way to fetch data in React components will likely be based on the “suspense” API [introduced at JSConf Iceland](/blog/2018/03/01/sneak-peek-beyond-react-16.html). Both simple data fetching solutions and libraries like Apollo and Relay will be able to use it under the hood. It is significantly less verbose than either of the above solutions, but at the moment it is not quite ready yet.
91+
> In the longer term, the canonical way to fetch data in React components will likely be based on the “suspense” API [introduced at JSConf Iceland](/blog/2018/03/01/sneak-peek-beyond-react-16.html). Both simple data fetching solutions and libraries like Apollo and Relay will be able to use it under the hood. It is significantly less verbose than either of the above solutions, but will not be finalized in time for the 16.3 release.
9292
9393
### Adding event listeners (or subscriptions)
9494

@@ -124,7 +124,7 @@ As of version 16.3, the recommended way to update `state` in response to `props`
124124

125125
> Note
126126
>
127-
> If you're writing a shared component, the [`react-lifecycles-compat`](https://github.com/reactjs/react-lifecycles-compat) polyfill enables the new lifecycle to be used with older versions of React as well. [Learn more about how to use it below.](#open-source-project-maintainers)
127+
> If you're writing a shared component, the [`react-lifecycles-compat`](https://github.com/reactjs/react-lifecycles-compat) polyfill enables the new `getDerivedStateFromProps` lifecycle to be used with older versions of React as well. [Learn more about how to use it below.](#open-source-project-maintainers)
128128
129129
### Invoking external callbacks
130130

examples/update-on-async-rendering/adding-event-listeners-create-subscription.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import {createSubscription} from 'create-subscription';
22

33
const Subscription = createSubscription({
4-
getCurrentValue(source) {
5-
// Return the current value of the subscription (source).
4+
getCurrentValue(sourceProp) {
5+
// Return the current value of the subscription (sourceProp).
66
// highlight-next-line
7-
return source.value;
7+
return sourceProp.value;
88
},
99

10-
subscribe(source, callback) {
10+
subscribe(sourceProp, callback) {
1111
function handleSubscriptionChange() {
12-
callback(dataSource.value);
12+
callback(sourceProp.value);
1313
}
1414

15-
// Subscribe (e.g. add an event listener) to the subscription (source).
15+
// Subscribe (e.g. add an event listener) to the subscription (sourceProp).
1616
// Call callback(newValue) whenever a subscription changes.
1717
// highlight-next-line
18-
source.subscribe(handleSubscriptionChange);
18+
sourceProp.subscribe(handleSubscriptionChange);
1919

2020
// Return an unsubscribe method.
2121
// highlight-range{1-3}
2222
return function unsubscribe() {
23-
source.unsubscribe(handleSubscriptionChange);
23+
sourceProp.unsubscribe(handleSubscriptionChange);
2424
};
2525
},
2626
});

examples/update-on-async-rendering/updating-state-from-props-after.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ExampleComponent extends React.Component {
77
isScrollingDown: false,
88
lastRow: null,
99
};
10-
// highlight-line
10+
1111
// highlight-range{1-8}
1212
static getDerivedStateFromProps(nextProps, prevState) {
1313
if (nextProps.currentRow !== prevState.lastRow) {

0 commit comments

Comments
 (0)