If have two elements, then I can refer from one of those to the other using useRef
.
The result of useRef
is a reference to the element, lets call it exampleRef
.
Is it possible to react to a size change of that element (e.g. on exampleRef.current.offsetHeight
)?
I tried to use the following, which is unfortunately not firing when the referenced element is resized:
useEffect ( () => {
// ... do something with exampleRef.current.offsetHeight
}, [exampleRef]);