useMediaQuery

useMediaQuery

import useMediaQuery from "@kiwicom/orbit-components/lib/hooks/useMediaQuery";
const Component = () => {
const { isDesktop } = useMediaQuery();
return <div>{isDesktop ? "We are on desktop" : "We are on mobile or tablet"}</div>;
};

Return

NameTypeDescription
isMediumMobilebooleantrue if viewport equals or is more than 414px
isLargeMobilebooleantrue if viewport equals or is more than 576px
isTabletbooleantrue if viewport equals or is more than 768px
isDesktopbooleantrue if viewport equals or is more than 992px
isLargeDesktopbooleantrue if viewport equals or is more than 1200px
prefersReducedMotionbooleantrue if device uses reduced motion. Please mind that this media query selector doesn’t work on IE10+ and therefore it will be always false