@schibstedspain/sui-react-hooks
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -5,2 +5,11 @@ # Change Log | ||
# 1.9.0 (2020-02-24) | ||
### Features | ||
* useMediaQuery hook ([2781d00](https://github.com/SUI-Components/schibsted-spain-components/commit/2781d00d4996903de7d396137bd99857f6d74812)) | ||
# 1.8.0 (2020-02-21) | ||
@@ -7,0 +16,0 @@ |
@@ -8,2 +8,3 @@ export default function ReactHooks() { | ||
} | ||
export { default as useMediaQuery } from './useMediaQuery'; | ||
export { default as useLegacyState } from './useLegacyState'; | ||
@@ -10,0 +11,0 @@ export { default as useMount } from './useMount'; |
{ | ||
"name": "@schibstedspain/sui-react-hooks", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -141,2 +141,18 @@ # ReactHooks | ||
### useMediaQuery | ||
This is a CSS media query hook for React. It listens for matches to a CSS media query. It allows the rendering of components based on whether the query matches or not. | ||
Hook `useMediaQuery` always returns a boolean and it indicates if query matches or not. | ||
```js | ||
import {useMediaQuery} from '@schibstedspain/sui-react-hooks' | ||
export default function Demo() { | ||
const isMatching = useMediaQuery('(min-width:600px)'); | ||
return <span>{`(min-width:600px) matches: ${isMatching}`}</span>; | ||
} | ||
``` | ||
> **Find full description and more examples in the [demo page](#).** |
13244
10
153
157