react 问题记录

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

转载于:https://www.cnblogs.com/YangqinCao/p/7685971.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值