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

https://github.com/streamich/react-use-media

react-media hook
https://github.com/streamich/react-use-media

Last synced: 11 months ago
JSON representation

react-media hook

Awesome Lists containing this project

README

          

# react-use-media

[`react-media`](https://github.com/ReactTraining/react-media) using hooks.

```js
import {useMedia} from 'react-use-media';

const Demo = () => {
const isWide = useMedia({
minWidth: 1000,
});

return (


Screen is wide: {isWide ? '😃' : '😢'}

);
};
```

Or, prepare hook once.

```js
const useMedia = createUseMedia({
minWidth: 1000,
});

const Demo = () => {
const isWide = useMedia();

return (


Screen is wide: {isWide ? '😃' : '😢'}

);
};
```