koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
18 lines (17 loc) • 461 B
JavaScript
"use client";
import { useState as c, useEffect as i } from "react";
const h = (s) => {
const [t, a] = c(!1);
return i(() => {
const e = window.matchMedia(s);
if (!window.matchMedia)
return;
e.matches !== t && a(e.matches);
const n = () => a(e.matches);
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
}, [t, s]), t;
};
export {
h as useMatchMedia
};
//# sourceMappingURL=useMatchMedia.js.map