Browse Source

Update refs-and-the-dom.md

main
Dan Abramov 7 years ago
committed by GitHub
parent
commit
2bd8eda1fc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      content/docs/refs-and-the-dom.md

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

@ -33,7 +33,7 @@ Your first inclination may be to use refs to "make things happen" in your app. I
> Note > Note
> >
> 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. > 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.
### Creating Refs ### Creating Refs
@ -56,7 +56,7 @@ class MyComponent extends React.Component {
When a ref is passed to an element in `render`, a reference to the node becomes accessible at the `current` attribute of the ref. When a ref is passed to an element in `render`, a reference to the node becomes accessible at the `current` attribute of the ref.
```javascript ```javascript
const node = this.myRef.current const node = this.myRef.current;
``` ```
The value of the ref differs depending on the type of the node: The value of the ref differs depending on the type of the node:

Loading…
Cancel
Save