react-media-hook
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -12,3 +12,11 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "useMediaPredicate", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useMediaPredicate.useMediaPredicate; | ||
} | ||
}); | ||
var _useMedia = require("./useMedia"); | ||
var _useMedia = require("./useMedia"); | ||
var _useMediaPredicate = require("./useMediaPredicate"); |
{ | ||
"name": "react-media-hook", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "React Hook for media query", | ||
@@ -58,2 +58,2 @@ "main": "./dist/index.js", | ||
} | ||
} | ||
} |
@@ -22,11 +22,10 @@ # react-media-hook | ||
Pass query to *useMedia*: | ||
Pass query to *useMediaPredicate*: | ||
```javascript | ||
import React from "react"; | ||
import { useMedia } from "react-media-hook"; | ||
import { useMediaPredicate } from "react-media-hook"; | ||
const Component = () => { | ||
const mediaResult = useMedia("(min-width: 400px)"); | ||
const biggerThan400 = mediaResult && mediaResult.matches; | ||
const biggerThan400 = useMediaPredicate("(min-width: 400px)"); | ||
@@ -44,3 +43,3 @@ return <div> | ||
Returns *undefined* (for example, in Node.js environment | ||
where *mathMedia* is not defined), or object: | ||
where *mathMedia* is not defined), or object, simular to *mathMedia(...)* result: | ||
```javascript | ||
@@ -51,2 +50,5 @@ { | ||
} | ||
``` | ||
``` | ||
#### `useMediaPredicate(query: string)` | ||
Returns just *true* or *false*. |
// @flow | ||
export {useMedia} from "./useMedia"; | ||
export { useMedia } from "./useMedia"; | ||
export { useMediaPredicate } from "./useMediaPredicate" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8199
11
109
51