admin管理员组

文章数量:1421483

I know there is React.findDOMNode(ponent).value/focus(). I am looking for all the methods can be used with React.findDOMNode.

For example, I have an <input type='checkbox' ref='ponent' /> tag, and I tried React.findDOMNode(this.refsponent).selected (I dont know if it exists), and there is nothing.

I know there is React.findDOMNode(ponent).value/focus(). I am looking for all the methods can be used with React.findDOMNode.

For example, I have an <input type='checkbox' ref='ponent' /> tag, and I tried React.findDOMNode(this.refs.ponent).selected (I dont know if it exists), and there is nothing.

Share Improve this question edited Aug 25, 2015 at 9:34 Chris Martin 30.8k12 gold badges80 silver badges141 bronze badges asked Aug 25, 2015 at 9:22 Amon BazongoAmon Bazongo 2954 silver badges12 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

React.findDOMNode is described by the Top-Level API documentation:

DOMElement findDOMNode(ReactComponent ponent)

If this ponent 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. When render returns null or false, findDOMNode returns null.

The value returned is a native DOM element—not a React-specific type, which is why it's not covered by the React documentation.

You can always assign an event and use event.currentTarget.value

本文标签: javascriptReactfindDOMNode(component) list of methodsStack Overflow