Function useMediaQuery

  • Returns true if the window matches the media query, or false otherwise.

    Parameters

    • query: string

      The media query to match.

    • initialValue: boolean = false

      A value returned during the initial render.

    Returns boolean

    const isMatched = useMediaQuery('(min-width: 600px)');