UNPKG

@anoki/fse-ui

Version:

FSE UI components library

32 lines (31 loc) 716 B
import { useState as r, useEffect as i } from "react"; const m = (s) => { const [c, n] = r(!1); return i(() => { const e = window.matchMedia(s); n(e.matches); const t = (a) => { n(a.matches); }; return e.addEventListener("change", t), () => { e.removeEventListener("change", t); }; }, [s]), c; }, d = (s, c) => { const [n, e] = r(c); return i(() => { const t = window.matchMedia(s); e(t.matches); const a = (o) => { e(o.matches); }; return t.addEventListener("change", a), () => { t.removeEventListener("change", a); }; }, [s]), n; }; export { m as useMediaQuery, d as useMediaQueryV2 }; //# sourceMappingURL=index.es281.js.map