UNPKG

web-api-hooks

Version:

Essential set of React Hooks for convenient Web API consumption.

15 lines (14 loc) 440 B
/** * Tracks match state of a media query. * * @param query Media query to parse. * * @returns `true` if the associated media query list matches the state of the [`document`](https://developer.mozilla.org/docs/Web/API/Document), or `false` otherwise. * * @example * function Component() { * const isWidescreen = useMedia('(min-aspect-ratio: 16/9)'); * // ... * } */ export default function useMedia(query: string): boolean;