useReFocus

This Hook is available since v1.4.0.

A React Hook that helps to run a function when the page is refocused.

Demo

Source
This component will show a toast when the user refocuses on the window.

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

useReFocus(fn, options): void

Fn

A function that will be called when the page is refocused.

Options

interface UseReFocusOptions extends UseThrottledFnOptions { /** * Register focus event listener. */ registerReFocus?: (callback: AnyFunc) => void }

See useThrottledFn for more information.