FindDOMNode and GetDOMNode
On your first observation you will not be able to detect any difference between FindDOMNode and GetDOMNode. From react 0.13 component.getDOMNode() is deprecated. React.findDOMNode(component) should be used instead of component.getDOMNode(). The base class for ES6 based components will not have getDOMNode. GetDOMNode() throws a warning in 0.13 and 0.14 version which is removed in version 0.15. GetDOMNode is the old API for accessing a refs DOM node and FindDOMNode is the new way.
Here is how both are used:
React.findDOMNode(this.refs.email).value
this.refs.email.getDOMNode().value
After React version 0.14 it is not necessary to call findDOMNode or GetDOMNode for React DOM components. So to ref to a DOM node just do as in the given example.
this.refs.giraffe
Comments
0 comments
Please Sign in or Create an account to Post Comments