Skip to content

Commit

Permalink
Merge intro paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Mar 4, 2018
1 parent 6627687 commit 0e7243f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions content/docs/refs-and-the-dom.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ Your first inclination may be to use refs to "make things happen" in your app. I
>
>The examples below have updated to use the `React.createRef()` API introduced in React 16.3.

Refs can be created using `React.createRef()` and are commonly assigned to an instance property when a component is constructed.
Refs can be created using `React.createRef()` and attached to React elements via the `ref` attribute. Refs are commonly assigned to an instance property when a component is constructed so they can be referenced throughout the the component.

```javascript{4,7}
class MyComponent extends React.Component {
Expand All @@ -52,8 +51,6 @@ class MyComponent extends React.Component {
}
```

Refs can then be attached to React elements via the `ref` attribute by passing the property on the class instance as the value to that attribute.

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. For example, this code uses a `ref` to store a reference to a DOM node:

```javascript{5,12,22}
Expand Down

0 comments on commit 0e7243f

Please sign in to comment.