useMediaQuery
the useMediaQuery module provides hooks for working with responsive breakpoints in React applications. its written using the window.matchMedia API and facade pattern.
this module provides 3 hooks:
-
useMediaQuery: you can pass any css query string to this hook, it also supports auto complete. -
useMediaQueryBreakpoint: based on Tailwind breakpoints, by default similar to tailwindcss it uses mobile first approach and usesmin-widthyou can swap the direction tomaxto check for the breakpoint and below -
useIsMobile: returns true onsm/640px/40remand below