Rehooks
Hooks

useHover

A hook that returns a boolean value indicating whether the user is hovering over an element.

useHover

A hook that returns a boolean value indicating whether the user is hovering over an element.

Usage

import { useHover } from "rehooks-ts";
 
function Component() {
  const isHovering = useHover();
 
  return <div>Is hovering: {isHovering ? "Yes" : "No"}</div>;
}

API

useHover

function useHover(): boolean;

Returns a boolean value indicating whether the user is hovering over the element.

Returns

NameTypeDescription
isHoveringbooleanA boolean value indicating whether the user is hovering over the element.

On this page