mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-26 10:25:14 +00:00
20 lines
623 B
TypeScript
20 lines
623 B
TypeScript
/**
|
|
* Match a media query and get updates as the match changes. The media string is
|
|
* passed directly to `window.matchMedia` and run as a Layout Effect, so initial
|
|
* matches are returned before the browser has a chance to paint.
|
|
*
|
|
* ```tsx
|
|
* function Page() {
|
|
* const isWide = useMediaQuery('min-width: 1000px')
|
|
*
|
|
* return isWide ? "very wide" : 'not so wide'
|
|
* }
|
|
* ```
|
|
*
|
|
* Media query lists are also reused globally, hook calls for the same query
|
|
* will only create a matcher once under the hood.
|
|
*
|
|
* @param query A media query
|
|
*/
|
|
export default function useMediaQuery(query: string | null): boolean;
|