Skip to content

@reach/window-size

useWindowSize - WindowSize

Measure the current window dimensions.

Installation

npm install @reach/window-size
# or
yarn add @reach/window-size

And then import it:

import WindowSize, { useWindowSize } from "@reach/window-size";

useWindowSize

Resize your window.

Window size: {
  "width": 0,
  "height": 0
}

Hook that observes and returns the measurements of the browser window.

WindowSize

Resize your window.

{
  "width": 0,
  "height": 0
}

WindowSize Props

PropTypeRequired
childrenfunctrue

WindowSize children

Type: func: (({ width, height })) => node

A function that calls back to you with the window size.