Skip to Content
react-utilsuseWindowSize

useWindowSize

See source on Github

Tracks window size which updates on window resize.

  • @param options - Configurable options
  • @returns An object containing size information

Example

const { innerWidth, innerHeight } = useWindowSize(ref) if (!innerWidth) return null return <div>{innerWidth} x {innerHeight}</div>