Skip to content

WindowSize

Calls back with the window dimensions.

<WindowSize>
  {(size) => (
    <div>
      <div>Resize your window.</div>
      <pre>{JSON.stringify(size, null, 2)}</pre>
    </div>
  )}
</WindowSize>
Resize your window.
{
  "width": false,
  "height": false
}

Installation

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

And then import it:

import WindowSize from "@reach/window-size";

Props

PropType
childrenfunc

children

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

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