[英]How to access more than one element of Dom in react using React.createRef()
[英]Cannot access DOM object through createRef
我是React JS的新手。 我正在尝试访问iframe的dom对象以更改其大小。
我的渲染中<iframe ref={this.myRef} ></iframe>
在构造函数中
this.myRef = React.createRef()
当我控制台日志(this.myRef.current)时,即使在我控制台(this.myRef)时也返回null,它在其中显示为current并且包含许多对象。
我使用的是“ react-dom”版本16.0.0,我已升级到最新版本-16.7.0,并且开始工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.