首页 > 其他 > 详细

react 问题记录

时间:2017-10-18 12:16:30      阅读:1054      评论:0      收藏:0      [点我收藏+]

1、控制台报错:

Uncaught Error: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component‘s `render` method, or you have multiple copies of React loaded

Uncaught Error: removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component‘s `render` method, or you have multiple copies of React loaded

如果检查了没有refs的错误,那么就有可能是你引入了多个react版本,我的项目使用的是yarn, yarn list react看下:

yarn list v1.1.0
├─ com1@1.0.5
│ └─ react@0.14.8
├─ comp2@0.0.4
│ └─ react@0.14.8
├─comp3@1.0.2
│ └─ react@0.14.8
├─ comp4@1.2.1
│ └─ react@0.14.8
├─ comp5@1.2.0
│ └─ react@0.14.8
└─ react@0.14.9

项目下面安装了react14.8 又安装了14.9

所以会有问题

参考https://github.com/callemall/material-ui/issues/6345

react 问题记录

原文:http://www.cnblogs.com/YangqinCao/p/7685971.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!