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/hooksAPI Reference
Signature
function useMediaQuery(query: string): booleanParameters
| 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.