Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/usehooks-ts.ts>useMediaQuery

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useMediaQuery
Deprecated
Deprecated
  • this useMediaQuery's signature is deprecated, it now accepts an query parameter and an options object.
import { useMediaQuery } from "https://deno.land/x/netzo@0.5.63/deps/usehooks-ts.ts";

Custom hook for tracking the state of a media query.

Examples

const isSmallScreen = useMediaQuery('(max-width: 600px)'); // Use isSmallScreen to conditionally apply styles or logic based on the screen size.

Parameters

query: string
  • The media query to track.
defaultValue: boolean
  • The default value to return if the hook is being run on the server (default is false).

Returns

boolean

The current state of the media query (true if the query matches, false otherwise).