Browse Source

feat(react-dom-reference): update findDOMNode API (#202)

* feat(react-dom-reference): update findDOMNode API

* Fixed confusing wording on findDOMNode

* Reword and make more precise
main
Ferdy Budhidharma 7 years ago
committed by Dan Abramov
parent
commit
f456a7a9b8
  1. 4
      content/docs/reference-react-dom.md

4
content/docs/reference-react-dom.md

@ -95,7 +95,9 @@ Remove a mounted React component from the DOM and clean up its event handlers an
```javascript
ReactDOM.findDOMNode(component)
```
If this component has been mounted into the DOM, this returns the corresponding native browser DOM element. This method is useful for reading values out of the DOM, such as form field values and performing DOM measurements. **In most cases, you can attach a ref to the DOM node and avoid using `findDOMNode` at all.** When `render` returns `null` or `false`, `findDOMNode` returns `null`.
If this component has been mounted into the DOM, this returns the corresponding native browser DOM element. This method is useful for reading values out of the DOM, such as form field values and performing DOM measurements. **In most cases, you can attach a ref to the DOM node and avoid using `findDOMNode` at all.**
When a component renders to `null` or `false`, `findDOMNode` returns `null`. When a component renders to a string, `findDOMNode` returns a text DOM node containing that value. As of React 16, a component may return a fragment with multiple children, in which case `findDOMNode` will return the DOM node corresponding to the first non-empty child.
> Note:
>

Loading…
Cancel
Save