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
I was wondering if it is possible to observe some other element? I.e. I have a component, but I would not like to assign the ref to the component I am returning, rather I want this component to observe and take action based on whether or not another component is intersecting the viewport. I figured I would find it e.g. using document.getElementById.
Effectively, I am trying to detect whether or not a toolbar is active, as it has a fixed position at the top of the screen and is overlapping some of my content. Sadly, it's a piece of functionality integrated from a third party, so I don't have much control over it in my React tree/state management.
Activity
thebuilder commentedon Jun 23, 2021
You can call the
ref()with an element inside anuseEffect. This would allow you set it to the element you get fromgetElementById.thebuilder commentedon Jun 23, 2021
See #480 for a few different ideas