You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
Some components need to have a reference to a DOM element created by their consumers. For example, a Popover component needs to know its target's DOM element's position to render the content next to it:
Some components need to have a reference to a DOM element created by their consumers. For example, a
Popover
component needs to know itstarget
's DOM element's position to render the content next to it:We are going to consider 3 approaches:
1. Ref is handled by the consumers
Result:
Pros:
Cons:
2. Wrap target with an element ex:
span
and then ref to that
span
elementResult:
Pros:
Cons:
3. Find a the DOM that created from target's React Component
Pros:
Cons:
How: Using ReactDOM.findElement().
Thought
On the
Popover
case, I think Solution#3
is should fit the most, since it maintain the DOM order also the convenience for library user.The text was updated successfully, but these errors were encountered: