Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/hooks/use-media-query

lib/hooks/use-media-query

SSR-safe media query hook.

Returns null until the media query can be evaluated (after hydration), then tracks the current match state reactively.

Functions

useMediaQuery()

useMediaQuery(query): boolean | null

Subscribe to a CSS media query.

Parameters

query

string

A valid media query string (e.g. "(min-width: 768px)")

Returns

boolean | null

null on the server / before hydration, then boolean

Last updated on