@frontify/fondue
Version:
Design system of Frontify
18 lines (17 loc) • 533 B
JavaScript
import { useState as o, useEffect as s } from "react";
const d = () => {
const [t, n] = o(!1);
return s(() => {
const e = () => {
const i = window.matchMedia("only screen and (max-width: 640px)").matches;
n(i);
};
return e(), window.addEventListener("resize", e), window.addEventListener("load", e), () => {
window.removeEventListener("resize", e), window.removeEventListener("load", e);
};
}, []), t;
};
export {
d as useMobileDetection
};
//# sourceMappingURL=useMobileDetection.es.js.map