use-css-query
v1.0.3
Published
## A tiny hook to track CSS media query state
Downloads
2
Readme
use-css-query
A tiny hook to track CSS media query state
Install
npm i use-css-query
yarn add use-css-query
pnpm add use-css-query
Usage
import useMediaQuery from 'use-css-query'
const App = () => {
// Accept css query
const matches = useMediaQuery('(max-width: 768px)')
return <div>Screen is less than 767px: {matches ? '😃' : '😢'}</div>
}