React Uncaught TypeError: _react2.default.findDOMNode is not a function

React报错提示:

Uncaught TypeError: _react2.default.findDOMNode is not a function

报错原因:

React版本过高,不支持React.render

React.findDOMNode(this.refs.confirm).focus();

解决方案:

1.降级React版本

2.使用ReactDOM.render

import ReactDOM from 'react-dom'

ReactDOM.findDOMNode(this.refs.confirm).focus();

有疑问或技术交流,扫描公众号一起讨论学习。

更多React在线学习访问:http://each.sinaapp.com/react/index.html

猜你喜欢

转载自qiaolevip.iteye.com/blog/2302164