-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
[fr] allow refs on SFCs #10230
Comments
A couple issues that would have to be overcome to make this a possibility:
#4936 has some more context on the reasoning behind this. |
|
The goal of functional components is to be able to not create Fibers for them in the future in some cases. So I don’t think we can store any data associated with functional components. |
@gaearon the data for them has to be stored somewhere in the tree though right? Otherwise you wouldn't have been able to diff? It occurred to me that only supporting callback refs for SFC would help solve the problem since the only time a lookup would need to happen is initial mount and then it's up to the consumer to handle the reference. |
React does not diff composite props. It only diffs props for host components, e.g. |
Gotcha. Callback ref should still solve the issue I believe since it's
point in time and then the responsibility of maintaining the reference is
on the consumer?
|
The callback itself would have to live somewhere. |
Do you want to request a feature or report a bug?
feature
What is the current behavior?
refs on SFC do not currently work
What is the expected behavior?
taking a ref on a SFC should be the equivalent of calling
findDOMNode
and simply return the highest DOM node from the rendered outputThe text was updated successfully, but these errors were encountered: