mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
24 lines
392 B
Markdown
24 lines
392 B
Markdown
# `useMeasure`
|
|
|
|
React sensor hook that reacts to changes in size of any of the observed elements.
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import { useMeasure } from "react-use";
|
|
|
|
const Demo = () => {
|
|
const [ref, { width, height }] = useMeasure();
|
|
|
|
return (
|
|
<div ref={ref}>
|
|
<div>width: {width}</div>
|
|
<div>height: {height}</div>
|
|
</div>
|
|
);
|
|
};
|
|
```
|
|
|
|
## Related hooks
|
|
|
|
- [useSize](./useSize.md) |