@maroun-baydoun/use-media-query
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@maroun-baydoun/use-media-query

Listen to media query matches in React

npm version

Install

npm i @maroun-baydoun/use-media-query

Or

yarn add @maroun-baydoun/use-media-query

expects react >= 16.8.0 to 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.

Dependents (0)

Package Sidebar

Install

npm i @maroun-baydoun/use-media-query

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

12.8 kB

Total Files

6

Last publish

Collaborators

  • maroun-baydoun