An open API service indexing awesome lists of open source software.

https://github.com/bence-toth/react-hook-media-query

A React hook to match media queries
https://github.com/bence-toth/react-hook-media-query

media-queries react react-hooks

Last synced: 4 days ago
JSON representation

A React hook to match media queries

Awesome Lists containing this project

README

        

# react-hook-media-query :triangular_ruler:

A React hook to match media queries.

## Installation

Using `npm`:

```sh
npm install --save react-hook-media-query
```

Using `yarn`:

```sh
yarn add react-hook-media-query
```

## Usage

```jsx
import React from 'react'
import useMediaQuery from 'react-hook-media-query'

const ComponentWithMediaQuery = () => {
const small = useMediaQuery('(max-width: 720px)')

return (

Viewport width is {small ? 'below' : 'above'} 720.


)
}
```

## Contributions

Contributions are welcome. File bug reports, create pull requests, feel free to reach out at [email protected].

## Licence

LGPL-3.0