Cant use ref over nested components
See original GitHub issueim trying to use nodeRef to handle my draggable component but i get a bad manner on it. Here is a basic example of my code:
<Draggable axis="y" nodeRef={draggableRef}>
<div>
<div ref={draggableRef}>
Click here to drag the component!!
</div>
<div>
</Draggable>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
React ref a nested component - Stack Overflow
Yes, child ref is accessible since it is part of real DOM. I made a simple example with two nested components, check it...
Read more >v7 register forward refs failed with nested components #4913
Describe the bug register forward refs failed while nesting components. Expected behavior ref to be created properly with the spread ...
Read more >Forwarding Refs - React
Ref forwarding is a technique for automatically passing a ref through a component to one of its children. This is typically not necessary...
Read more >Using Template Reference Variables to Interact with Nested ...
We can't access the @ViewChild variable in ngOnInit , ngOnChanges , or ngDoCheck because it can be accessed only after our view is...
Read more >React Stripe.js reference | Stripe Documentation
The Elements provider allows you to use Element components and access the Stripe object in any nested component. Render an Elements provider at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Having the same issue. Using ref on nested elements makes dragging very choppy.
*note that I am using a class component so I use
const handler = createRef(null);
instead ofuseRef
I have the same issue. I want to use
nodeRef
on nested handler, but then the dragging is very choppy. @STRML Do you know the reason. How can we fix this?