Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pipu11qiao opened this issue Nov 28, 2018 · 3 comments
Open

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

pipu11qiao opened this issue Nov 28, 2018 · 3 comments

Comments

@pipu11qiao
Copy link

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

@cycle263
Copy link

cycle263 commented Apr 9, 2019

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

@xinlong0918
Copy link

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

@xilihuasi
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants