useMediaQuery()
The
useMediaQuery() hook allows you to programmatically check if the current viewport matches a specific CSS media query string.Import
typescript
Usage
Match state for (min-width: 768px)
False (Mobile)
Component.tsx
API
Arguments
query– string The CSS media query string to parse and match (e.g., '(min-width: 768px)').
Returns
matches– boolean Returns true if the document currently matches the media query.