-
Notifications
You must be signed in to change notification settings - Fork 26k
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 ref
doesn't work with dynamically imported components
#2842
Comments
The component imported is actually all instances of "DynamicComponent" for me, thus all refs are not working. |
Dynamically imported Components are wrapped in a DynamicComponent. Since React does not allow forwarding ref maybe you could substitute ref for innerRef like styled-components[#102] |
There's a new API coming in future React that allows to pass off ref. |
Any hack for now? |
Seriously need a hack |
I use this to get ref
|
Expected Behavior
When creating a callback reference to a dynamically imported component, the reference should resolve to the component as if it had been imported normally.
Current Behavior
The ref behaves strangely. The reference to the component doesn't seem to have any of the attributes or state of the component -- all
undefined
.Steps to Reproduce (for bugs)
Here's a nice smallish example. Bring your own boilerplate
components/page.js
pages/refs.js
components/child.js
Context
I'm trying to create a wrapper around a wrapper around React-RTE. The first layer wrapper has a
getValue()
method one can use to extract the transformed value from React-RTE. The transformation is non-trivial and kind of expensive, so it makes sense to do it on-demand, and the component that should demand it is in the second-layer component. The first layer wrapper needs to be loaded dynamically (with SSR disabled).Your Environment
The text was updated successfully, but these errors were encountered: