mirror of
https://github.com/streamich/react-use.git
synced 2026-01-25 14:17:16 +00:00
23 lines
358 B
Markdown
23 lines
358 B
Markdown
# `useSize`
|
|
|
|
React sensor hook that tracks size of an HTML element.
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
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>
|
|
);
|
|
};
|
|
```
|
|
## Related hooks
|
|
|
|
- [useSize](./useSize.md) |