javascript - 使用 ref 相关疑问

查看:71
本文介绍了javascript - 使用 ref 相关疑问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

在控件声明 ref 报错

eg.

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 (details: https://fb.me/react-refs-must-have-owner).

求解答 !

解决方案

估计是我没继承 extends React.Component 造成的, 已经解决!

这篇关于javascript - 使用 ref 相关疑问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆