Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
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.
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.108/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).