Measure React elements position in the DOM
npm install @reach/rect !MIT license
Measures DOM elements (aka. bounding client rect). See also Element.getBoundingClientRect()
``jsx
import { Rect, useRect } from "@reach/rect";
function Example() {
const ref = React.useRef();
const rect = useRect(ref);
return (
{JSON.stringify(rect, null, 2)}