usebrowserwindowsize

0.1.2 • Public • Published

📐 useBrowserWindowSize

React hook for getting width and height of browser window. Will update on window resize event.

🚀 Getting Started

Usage: useBrowserWindowSize react hook

Add to your project npm i usebrowserwindowsize or using yarn yarn add usebrowserwindowsize.

Simply import the hook to your component.

import useBrowserWindowSize from 'usebrowserwindowsize';

Then you can destruct either width or height (or both) from the hooks return value (Array). Please note that it will be [0, 0] initially.

const [ windowWidth, windowHeight ] = useBrowserWindowSize();

All properties typed as integers.

Package Sidebar

Install

npm i usebrowserwindowsize

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

4.04 kB

Total Files

4

Last publish

Collaborators

  • maxomolin