@blocdigital/usemediaquery
v0.1.3
Published
Simple hook to listen for media query changes.
Downloads
73
Readme
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>;
};