useMediaQuery
Ease with media query
Usage
Live Editor
function Demo() { const isWide = useMediaQuery("(min-width: 480px)"); return <div>Screen is wide: {isWide ? "Yes" : "No"}</div>; };
Result
Loading...
API
useMediaQuery
Returns
boolean
: whether comply with media inquiries
Arguments
Argument | Description | Type | DefaultValue |
---|---|---|---|
query | media query string | string (Required) | - |
defaultState | default value | boolean | undefined | - |