import SEO from "../components/SEO";
import { TOC, TOCList, TOCLink } from "../components/TOC";
# Window Size
useWindowSizeWindowSize
Measure the current window dimensions.
## Installation
From the command line in your project directory, run `npm install @reach/window-size` or `yarn add @reach/window-size`. Then import the component or hook that you need:
```bash
npm install @reach/window-size
# or
yarn add @reach/window-size
```
```js
import WindowSize, { useWindowSize } from "@reach/window-size";
```
## Component API
### WindowSize
```jsx
// jsx-demo
function Example() {
return (
{(size) => (
Resize your window.
{JSON.stringify(size, null, 2)}
)}
);
}
```
#### WindowSize Props
| Prop | Type | Required |
| ----------------------- | ------ | -------- |
| [`children`](#children) | `func` | true |
##### WindowSize `children`
`children: (size: { width: number; height: number }) => React.ReactElement`
A function that calls back to you with the window size.
### `useWindowSize`
A hook that observes and returns the measurements of the browser window.
```jsx
// jsx-demo
function Example() {
const { width, height } = useWindowSize();
return (