mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
22 lines
319 B
Markdown
22 lines
319 B
Markdown
# `useWindowSize`
|
|
|
|
React sensor hook that tracks dimensions of the browser window.
|
|
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import {useWindowSize} from 'react-use';
|
|
|
|
const Demo = () => {
|
|
const {width, height} = useWindowSize();
|
|
|
|
return (
|
|
<div>
|
|
<div>width: {width}</div>
|
|
<div>height: {height}</div>
|
|
</div>
|
|
);
|
|
};
|
|
```
|