【问题标题】:"Cannot read property 'findDOMNode' of undefined" when using React-widgets使用 React-widgets 时“无法读取未定义的属性‘findDOMNode’”
【发布时间】:2015-11-30 23:42:29
【问题描述】:

我正在使用 React & React-router、0.13.3 和 React-widgets 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 的菜鸟。

【问题讨论】:

    标签: javascript reactjs


    【解决方案1】:

    您使用的 React-widgets 版本需要 React 0.14 和 React-Dom 0.14

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

    这是给 npm 的。抱歉,我不知道凉亭中的等价物...

    npm update react
    npm install react-dom
    

    【讨论】:

    • 非常感谢;会试试的。
    猜你喜欢
    • 1970-01-01
    • 2021-10-15
    • 1970-01-01
    • 2019-09-17
    • 2019-04-09
    • 2020-10-10
    • 2019-02-15
    • 2020-07-23
    • 2019-07-22
    相关资源
    最近更新 更多