React.findDOMNode(component) list of methods

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

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

Answers:

Answer

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

DOMElement findDOMNode(ReactComponent 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. 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.

Answer

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

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.