useMedia
Hook using media queries.
Code demonstration
API
const value = useMedia(['(min-width: 320px)'], [true], false)
const value = useMedia(['(min-width: 320px)'], [true], false)
Options
Property | Description | Type | Default |
---|---|---|---|
queries | Media to query for an array of objects | string[] | - |
values | The default value for each media query object | boolean[] | - |
defaultValue | DefaultValue | boolean |
Result
Property | Description | Type |
---|---|---|
value | Compliance with the query | Readonly<Ref<boolean>> |