"无法读取属性'findDOMNode'未定义的“;当使用React小部件时

"Cannot read property 'findDOMNode' of undefined" when using React-widgets

本文关键字:React 小部 未定义 quot 读取 findDOMNode 属性      更新时间:2023-09-26

我正在使用React&React路由器,0.13.3,React小部件3.1.0,都安装了bower;和早午餐。

在一条路线中,我创建了一个下拉列表,比如:

render: function()
{
  var trylist = ['pink', 'red', 'blue', 'white' ];
  var DropdownList = ReactWidgets.DropdownList;
  return (<DropdownList defaultValue="red" data={trylist} /> )
}

当我点击下拉列表时,它在控制台中显示以下错误:

未捕获的类型错误:无法读取未定义的属性"findDOMNode"

该文件显示为react widgets.js:2015。在此文件/行:

      findDOMNode: function findDOMNode(component) {
    return _reactDom2['default'].findDOMNode(component);

非常感谢您的帮助!我对JS、React相当陌生。

您正在使用的React小部件版本需要React 0.14和React Dom 0.14

您需要升级到React 0.14.3并安装React Dom。

这是给npm的。对不起,我不知道bower中的对等词。。。

npm update react
npm install react-dom