1.0.17 • Published 4 years ago
get-viewport-sizes v1.0.17
Installation
npm install get-viewport-sizesTo use, call getSizes() at the top of your entry file to populate --vh and --vw
import { getSizes } from 'get-viewport-sizes';
getSizes(200); // where 200 (default) is the timeout for debounce You may then use the var in css like this
main {
height: var(--vh * 0.8) //80% of vh
}React Hook
You may also use React hook to get the updated with and height
const { width, height } = useGetViewportSizes(200) // where 200(default) is the timeout for debounceHook will return width and height as float