Skip to content

Commit b1adba0

Browse files
committed
Recommend old API when applicable
1 parent 04c7f16 commit b1adba0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/docs/refs-and-the-dom.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ For example, instead of exposing `open()` and `close()` methods on a `Dialog` co
3131

3232
Your first inclination may be to use refs to "make things happen" in your app. If this is the case, take a moment and think more critically about where state should be owned in the component hierarchy. Often, it becomes clear that the proper place to "own" that state is at a higher level in the hierarchy. See the [Lifting State Up](/docs/lifting-state-up.html) guide for examples of this.
3333

34-
>**Note:**
34+
> Note
3535
>
36-
>The examples below have updated to use the `React.createRef()` API introduced in React 16.3.
36+
> The examples below have been updated to use the React.createRef() API introduced in React 16.3. If you are using an earlier release of React, we recommend using [#callback-refs](callback refs) instead.
3737
3838
### Creating Refs
3939

@@ -59,10 +59,10 @@ When a ref is passed to an element in `render`, a reference to the node becomes
5959
const node = this.myRef.value
6060
```
6161

62-
The value of the ref differs depending on whether the node is an HTML DOM node, a React class component instance, or a stateless functional component:
62+
The value of the ref differs depending on the type of the node:
6363

6464
- When the `ref` attribute is used on an HTML element, the `ref` created in the constructor with `React.createRef()` receives the underlying DOM element as its `value` property.
65-
- When the `ref` attribute is used on a custom component declared as a class, the `ref` object receives the mounted instance of the component as its `value`.
65+
- When the `ref` attribute is used on a custom class component, the `ref` object receives the mounted instance of the component as its `value`.
6666
- **You may not use the `ref` attribute on functional components** because they don't have instances.
6767

6868
The examples below demonstrate the differences.

0 commit comments

Comments
 (0)