@konstructio/ui
Version:
A set of reusable and customizable React components built for konstruct.io
18 lines (17 loc) • 481 B
JavaScript
import { r as n } from "../utils-COaoD3PI.js";
import { useEffect as c, useState as h } from "react";
var m = (e) => n ? window.matchMedia(e).matches : !1, u = (e) => {
const [s, a] = h(() => m(e));
return c(() => {
if (!n) return;
const t = window.matchMedia(e), r = (i) => {
a(i.matches);
};
return a(t.matches), t.addEventListener("change", r), () => {
t.removeEventListener("change", r);
};
}, [e]), s;
};
export {
u as useMediaQuery
};