npm.io
1.0.3 • Published 4 years ago

react-use-window-sizes

Licence
MIT
Version
1.0.3
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
4

useWindowSizes - a custom React hook

A lightweight package to easily track window width & height in React.js

Comes in handy for responsize design and animations

Install

npm install react-use-window-sizes

Example

import React from 'react'
import { useWindowSizes } from 'react-use-window-sizes'

function MyApp() {
  const { width, height } = useWindowSizes();
  console.log('width:', width, 'height:', height) 

}

Keywords