useMediaQuery
Layout/Viewport
A React hook that tracks the state of a CSS media query and updates when it changes, providing reactive viewport and media condition detection.
Installation
npm install @thibault.sh/hooks
API Reference
Signature
function useMediaQuery(query: string): boolean
Parameters
Name | Type | Description | Default |
---|---|---|---|
query | string | The CSS media query string to track (e.g., '(min-width: 768px)'). | - |
Returns
boolean
Boolean indicating whether the media query currently matches.