Hooks
useMediaQuery
This is a CSS media query hook for React. It listens for matches to a CSS media query. It allows the rendering of components based on whether the query matches or not.
import { useMediaQuery } from '@vtex/admin-ui'
Usage
Loading...
Loading...
Parameter
type | required | description |
---|---|---|
string, string[] | ✅ | A unique media query or an array of queries |
Return Value
The useMediaQuery
hook returns an array of booleans, indicating whether the given query matches or queries match.
type | description |
---|---|
boolean[] | An array of matches for each query passed |