@blocdigital/usemediaquery
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

usemediaquery

Simple hook to listen for media query changes.

Install

npm install --save @blocdigital/usemediaquery

Usage

import React from 'react';

import useMediaQuery from '@blocdigital/usemediaquery';

const Example = () => {
  const [isMobile] = useMediaQuery('screen and (max-width: 479px)');
  return <div>{isMobile ? 'screen size is less than 480px' : 'screen size is 480px or greater'}</div>;
};

Package Sidebar

Install

npm i @blocdigital/usemediaquery

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

8.41 kB

Total Files

9

Last publish

Collaborators

  • hwickham
  • nadakbar
  • acol
  • link2twenty