Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rehooks/document-visibility
React hook for subscribing to document visibility
https://github.com/rehooks/document-visibility
document hooks react visibility
Last synced: 3 months ago
JSON representation
React hook for subscribing to document visibility
- Host: GitHub
- URL: https://github.com/rehooks/document-visibility
- Owner: rehooks
- License: mit
- Created: 2018-10-25T18:06:43.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-06T20:12:37.000Z (about 6 years ago)
- Last Synced: 2024-05-09T06:06:58.207Z (8 months ago)
- Topics: document, hooks, react, visibility
- Language: JavaScript
- Size: 72.3 KB
- Stars: 31
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-react-hooks - `@rehooks/document-visibility`
- awesome-react-hooks-cn - `@rehooks/document-visibility`
- awesome-react-hooks - `@rehooks/document-visibility`
- awesome-react-hooks - `@rehooks/document-visibility`
README
# `@rehooks/document-visibility`
> React hook for subscribing to document visibility
> **Note:** This is using the new [React Hooks API Proposal](https://reactjs.org/docs/hooks-intro.html)
> which is subject to change until React 16.7 final.
>
> You'll need to install `react`, `react-dom`, etc at `^16.7.0-alpha.0`## Install
```sh
yarn add @rehooks/document-visibility
```## Usage
```js
import useDocumentVisibility from '@rehooks/document-visibility';function MyComponent() {
let documentVisibility = useDocumentVisibility();
// documentVisibility = "hidden" | "visible" | "prerender"// ...
}
```