1.0.0 • Published 6 years ago
@maroun-baydoun/use-media-query v1.0.0
@maroun-baydoun/use-media-query
Listen to media query matches in React
Install
npm i @maroun-baydoun/use-media-queryOr
yarn add @maroun-baydoun/use-media-queryexpects
react >= 16.8.0to be installed as a peer dependency.
Use
import useMediaQuery from "@maroun-baydoun/use-media-query";
const MyComponent = () => {
const matches = useMediaQuery("only screen and (min-width: 1024px)");
return matches ? "It matches!" : "No match (yet)";
}Browser Compatibility
This library relies on the window.matchMedia API. Compatible browsers can be found here.
1.0.0
6 years ago
0.0.1-beta.3
6 years ago
0.0.1-beta.4
6 years ago
0.0.1-beta.2
6 years ago
0.0.1-beta.1
6 years ago