1.0.0 • Published 1 year ago

@reactutils/use-windows-size v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@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>
  );
}