AlloyViewer icon indicating copy to clipboard operation
AlloyViewer copied to clipboard

react 16 以上是不是不能用了 ref报错

Open pipu11qiao opened this issue 6 years ago • 3 comments

react 16 以上是不是不能用了 ref报错

pipu11qiao avatar Nov 28 '18 10:11 pipu11qiao

改成回调方式吧,兼容性更好

cycle263 avatar Apr 09 '19 07:04 cycle263

相同的问题:Element ref was specified as a string (imagelist) but no owner was set

xinlong0918 avatar Jul 02 '19 06:07 xinlong0918

edit index.js

<!-- just change -->
<ul id="imagelist" ref="imagelist" className="imagelist">
<!-- to -->
<ul id="imagelist" ref={ref => this.list = ref} className="imagelist">

and

// delete
this.list = this.refs['imagelist'];
// it'll be fine

xilihuasi avatar Dec 20 '19 00:12 xilihuasi