import * as React from "react";
export default function useMediaQuery(query) {
    const [matches, setMatches] = React.useState(false);
    React.useEffect(() => {
        const mediaQuery = window.matchMedia(query);
        const update = () => setMatches(mediaQuery.matches);
        update();
        mediaQuery.addEventListener("change", update);
        return () => {
            mediaQuery.removeEventListener("change", update);
        };
    }, [query]);
    return matches;
}
