Skip to main content

useWindowSize

useWindowSize(): object

Defined in: src/core/hooks/useWindowSize.ts:15

Hook to track window dimensions Replacement for react-use's useWindowSize

Returns

object

Object with width and height properties

height

height: number

width

width: number

Example

const { width, height } = useWindowSize();
console.log(`Window size: ${width}x${height}`);