React.js: The difference between findDOMNode and getDOMNode

后端 未结 2 638
野的像风
野的像风 2021-01-01 10:19

Could somebody tell me what\'s the difference between

React.findDOMNode(this.refs.email).value

and

this.refs.email.getDOMN         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-01 10:34

    The second one is the old API for accessing a refs DOM node, and the first one is the new way. So if you're using a recent version of React, you should use the first.

提交回复
热议问题