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

Improve warnings about refs on functional components during runtime and in docs #7267

Closed
pke opened this issue Jul 13, 2016 · 3 comments
Closed

Comments

@pke
Copy link

pke commented Jul 13, 2016

I had trouble to get ref working on one of my composite components.

This inline ref function

<MyComp ref={element => this.listElement = element}/>

will always be called with element===null on mount and unmount the like. Thats because MyComp is a stateless/functional component.

react should print a warning if one tries to use ref with stateless components.

@stephenkingsley
Copy link

I think stateless component just a tool, so in my options, this is unnecessary.

@Maximilianos
Copy link

This issue can be closed because I believe it has been resolved by: #8635

@aweary
Copy link
Contributor

aweary commented Jan 20, 2017

@Maximilianos thanks!

@aweary aweary closed this as completed Jan 20, 2017
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