# `useSize` React sensor hook that tracks size of an HTML element. ## Usage ```jsx import {useSize} from 'react-use'; const Demo = () => { const [sized, {width, height}] = useSize( ({width}) =>
Size me up! ({width}px)
, { width: 100, height: 100 } ); return (
{sized}
width: {width}
height: {height}
); }; ``` ## Reference ```js useSize(element, initialSize); ``` - `element` — sized element. - `initialSize` — initial size containing a `width` and `height` key. ## Related hooks - [useMeasure](./useMeasure.md)