useDocumentVisibility

Detect when the tab is visible or hidden.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Switch to another tab and back to see the value change.

APIs

useDocumentVisibility

const useDocumentVisibility = () => 'visible' | 'hidden'
Edit this page on GitHub