use-match-media-query
v1.0.1
Published
Match Media as a React hook!
Downloads
2
Readme
use-match-media-query
Match Media as a React hook!
Table of Contents
Usage
import {useMatchMediaQuery} from 'use-match-media-query'
const Comp = () => {
const isMobile = useMatchMediaQuery('screen and (max-width: 60em')
return isMobile ? 'on mobile' : 'not on mobile'
}
Install
This project uses node and npm.
$ npm install use-match-media-query
$ # OR
$ yarn add use-match-media-query
Safari
Having issues on Safari? You are not alone!.
Polyfills
Contribute
- Fork it and create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am "Add some feature"
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
License
MIT