# `useMeasurement` A set of hooks for gleaning arbitrary measurements from DOM elements. - `useMeasurement` allows the consumer to get any arbitrary measurement from the ref element. - `useElementHeight` and `useElementWidth` provide shortcuts to `offsetHeight` and `offsetWidth`, respectively. ## Example ```tsx const ref = useRef(null); const scrollHeight = useMeasurement({ ref, getMeasurement: (element) => element.scrollHeight, defaultValue: 0, });
Measure me!
``` ```tsx const ref = useRef(null); const divHeight = useElementHeight(ref);
I'm {divHeight} pixels tall!
``` ```tsx const ref = useRef(null); const divHeight = useElementWidth(ref);
I'm {divWidth} pixels wide!
```