@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
20 lines (19 loc) • 626 B
JavaScript
"use client";
import * as __rspack_external_react from "react";
function useMediaQuery(query) {
const [matches, setMatches] = __rspack_external_react.useState(false);
__rspack_external_react.useEffect(()=>{
const mql = globalThis.window.matchMedia(query);
const onChange = (event)=>{
setMatches(event.matches);
};
setMatches(mql.matches);
mql.addEventListener("change", onChange);
return ()=>mql.removeEventListener("change", onChange);
}, [
query
]);
return matches;
}
export { useMediaQuery };
//# sourceMappingURL=useMediaQuery.js.map