0.1.2 • Published 4 years ago
usebrowserwindowsize v0.1.2
📐 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.