Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/bogeyman76/documentvisible

A React hook to monitor if the current browser tab is visible or not.
https://github.com/bogeyman76/documentvisible

javascript jsx react react-hook typescript-react

Last synced: 19 days ago
JSON representation

A React hook to monitor if the current browser tab is visible or not.

Awesome Lists containing this project

README

        

DocumentVisible React Hook


This is a simple react hook to determine if the current browser tab is visible. The hook uses uses Reacts useSyncExternalStore:


https://react.dev/reference/react/useSyncExternalStore


Implentation:

const isVisible = DocumentVisible(); // true or false