Browse Source

doc: add createRef to Refs glossary (#875)

* doc: add createRef to Refs glossary

* doc: move newer api first
main
Tung Vu 7 years ago
committed by Dan Abramov
parent
commit
1f8fdac9cc
  1. 2
      content/docs/reference-glossary.md

2
content/docs/reference-glossary.md

@ -150,7 +150,7 @@ Don't pass something like `Math.random()` to keys. It is important that keys hav
## [Refs](/docs/refs-and-the-dom.html)
React supports a special attribute that you can attach to any component. The `ref` attribute can be a string or a callback function. When the `ref` attribute is a callback function, the function receives the underlying DOM element or class instance (depending on the type of element) as its argument. This allows you to have direct access to the DOM element or component instance.
React supports a special attribute that you can attach to any component. The `ref` attribute can be an object created by [`React.createRef()` function](/docs/react-api.html#reactcreateref) or a callback function, or a string (in legacy API). When the `ref` attribute is a callback function, the function receives the underlying DOM element or class instance (depending on the type of element) as its argument. This allows you to have direct access to the DOM element or component instance.
Use refs sparingly. If you find yourself often using refs to "make things happen" in your app, consider getting more familiar with [top-down data flow](/docs/lifting-state-up.html).

Loading…
Cancel
Save