Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 888 Bytes

File metadata and controls

37 lines (25 loc) · 888 Bytes

@reactutils/use-windows-size

NPM NPM

this hook returns an object containing the window's width and height. If executed server-side (no window object) the value of width and height will be undefined.

Installation

npm install @reactutils/use-windows-size

# or

yarn add @reactutils/use-windows-size

Usage

import useWindowSize from '@reactutils/use-windows-size';

// Usage
function App() {
  const size = useWindowSize();
  
  return (
    <div>
      {size.width}px / {size.height}px
    </div>
  );
}