Skip to content

Commit 935d2a1

Browse files
committed
Minor edits in response to PR feedback
1 parent a55480b commit 935d2a1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

content/blog/2018-02-07-react-v-16-3.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "React v16.3.0: New lifecycles and context"
33
author: [bvaughn]
44
---
55

6-
This release includes a new class component lifecycle (`getDerivedStateFromProps`), a new `StrictMode` component, an official context API, and a better way for managing refs!
6+
This release includes a new class component lifecycle (`getDerivedStateFromProps`), a new `StrictMode` component, an official context API, and a new ergonomic ref API!
77

88
For the past few months, the React team has been working on support for [asynchronous rendering](#). We are excited about the new features this will enable, and we've learned that some changes will be required to the way we write React components.
99

@@ -24,6 +24,12 @@ Previously, React provided two ways for managing refs: the legacy string ref API
2424
Version 16.3 adds a new option for managing refs that offers the convenience of a string ref without any of the downsides:
2525
`embed:16-3-release-blog-create-ref.js`
2626

27+
> **Note:**
28+
>
29+
> Callback refs will continue to be supported in addition to the new `createRef` API.
30+
>
31+
> You don't need to replace callback refs in your components. They are slightly more flexible, so they will remain as an advanced feature.
32+
2733
[Learn more about the new `createRef` API here.](#)
2834

2935
## Component Lifecycle Changes
@@ -50,7 +56,6 @@ We are also adding a new static lifecycle, `getDerivedStateFromProps`, as a safe
5056

5157
`StrictMode` is a tool for highlighting potential problems in an application. Like `Fragment`, `StrictMode` does not render any visible UI. It simply activates additional checks and warnings for its descendants.
5258

53-
5459
> **Note:**
5560
>
5661
> `StrictMode` checks are run in development mode only; they do not impact the production build.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
class MyComponent extends React.Component {
22
// highlight-next-line
3-
_divRef = React.createRef();
3+
divRef = React.createRef();
44

55
render() {
66
// highlight-range{4}
77
return (
88
<input
99
type="text"
10-
ref={this._divRef}
10+
ref={this.divRef}
1111
/>
1212
);
1313
}
1414

1515
componentDidMount() {
1616
// highlight-next-line
17-
this._divRef.value.focus();
17+
this.divRef.value.focus();
1818
}
1919
}

0 commit comments

Comments
 (0)