one-hook
Size
0.38 kb
View source

useDocumentHasFocus

Track the focus state of the document.

Installation

npm install @1hook/use-document-has-focus

Usage

import {  } from '@1hook/use-document-has-focus'

Track the document visibility:

const  = ()

API Reference

UseDocumentHasFocusOptions

The options for the useDocumentHasFocus hook.

PropTypeDefault
onChange?
((hasFocus: boolean) => void)
-

On this page