Returns the visibility state of the document. Returns null
on the server.
import {useEffect} from 'react'import {useDocumentVisibilityState} from "rooks"export default function App() {const isDocumentVisible = useDocumentVisibilityState();useEffect(() => {console.log(isDocumentVisible)}, [isDocumentVisible])return <p>Try switching to a different tab and check console </p>}
Join our discord server! You can click the floating discord icon at the bottom right of the screen and chat with us!