@kokojer/react-use-document-visibility (npm): This hook checks whether the browser tab the user is currently on is active  and how many times the user has left the page. Also provides a function where you can subscribe to changes in tab activity.
Keywords: react|hook|document|visibility