Was trying to use getBoundingClientRect like:
const menuWrapper = useRef<HTMLElement>(null);
const parentNode = menuWrapper?.current?.parentNode;
const { top, left, height, width } = parentNode?.getBoundingClientRect();
return (
<div ref={menuWrapper}>
...
</div>
)
But currently can't pass typescript error:
Property 'getBoundingClientRect' does not exist on type 'ParentNode'.
Anyone that know a way around this?