@mirawision/reactive-hooks
Version:
A comprehensive collection of 50+ React hooks for state management, UI interactions, device APIs, async operations, drag & drop, audio/speech, and more. Full TypeScript support with SSR safety.
15 lines (14 loc) • 447 B
TypeScript
/**
* A hook that tracks whether the current tab/page is visible to the user.
* Returns true when the page is visible, false when hidden.
* Defaults to true during SSR for optimistic rendering.
*
* @returns boolean indicating if the page is visible
*
* @example
* const isVisible = usePageVisibility();
* if (isVisible) {
* // Page is active, run animations or fetch data
* }
*/
export declare function usePageVisibility(): boolean;