import { useState, RefObject } from "react"; import useEventListener from "@hooks/useEventListener"; export default function useHover(ref: RefObject): boolean { const [hovered, setHovered] = useState(false); useEventListener("mouseover", () => setHovered(true), ref); useEventListener("mouseout", () => setHovered(false), ref); return hovered; }