mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
358 B
358 B
useSize
React sensor hook that tracks size of an HTML element.
Usage
import { useMeasure } from "react-use";
const Demo = () => {
const [ref, { width, height }] = useSize();
return (
<div ref={ref}>
<div>width: {width}</div>
<div>height: {height}</div>
</div>
);
};