UNPKG

web-api-hooks

Version:

Essential set of React Hooks for convenient Web API consumption.

15 lines (14 loc) 456 B
/** * Tracks visual viewport size. * * ⚗️ _The underlying technology is experimental. Please be aware about browser compatibility before using this in production._ * * @returns Dimensions `[width, height]`, falling back to `[0, 0]` when unavailable. * * @example * function Component() { * const [viewportWidth, viewportHeight] = useViewportSize(); * // ... * } */ export default function useViewportSize(): Readonly<[number, number]>;