@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>;
};

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    21
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    21
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i @blocdigital/usemediaquery

Weekly Downloads

21

Version

0.1.2

License

MIT

Unpacked Size

8.41 kB

Total Files

9

Last publish

Collaborators

  • hwickham
  • nadakbar
  • acol
  • link2twenty