useMediaQuery

Custom hook that tracks the state of a media query using the Match Media API.

Usage

import { useMediaQuery } from "@teasim/hooks";
export default function Component() {
const matches = useMediaQuery("(min-width: 768px)");
return <div>{`The view port is ${matches ? "at least" : "less than"} 768 pixels wide`}</div>;
}