useMedia

useMedia is an custom hook for utilizing media queries in your component logic.

Import#

import { useMedia } from '@dwarvesf/react-hooks'

Usage#

Parameters#

The useDisclosure hook accepts an list of following paramesters:

useMedia(queries, values, defaultValue)
NameTypeDefaultDescription
queriesstring[]_The list of media queries.
valuesany[]_The values relate to the list of media queries by array index.
defaultValueany_The default value if none of the values matches the media queries.