@supunlakmal/hooks
Version:
A collection of reusable React hooks
10 lines (9 loc) • 479 B
TypeScript
import { RefObject } from 'react';
/**
* Custom hook to detect whether a DOM element is being hovered over.
*
* @returns {[RefObject<T | null>, boolean]} A tuple containing:
* - ref: A React ref object (possibly null initially) to attach to the target DOM element.
* - isHovered: A boolean state indicating if the element is currently hovered.
*/
export declare const useHover: <T extends HTMLElement = HTMLElement>() => [RefObject<T | null>, boolean];