I have a simple example of a component:
function App() {
const observed = useRef(null);
console.log(observed.current);
return (
This is what I ended up doing since calling useEffect
on rlvRef
did not capture all events.
const rlvRef = useRef()
const [refVisible, setRefVisible] = useState(false)
useEffect(() => {
if (!refVisible) {
return
}
// detected rendering
}, refVisible)
return (
{ rlvRef.current = el; setRefVisible(!!el); }}
... />
)