Skip to content

useHover ​

Category
Sensors

Hook that defines the logic when hovering an element

typescript
import { useHover } from '@siberiacancode/reactuse';

Usage ​

typescript
const hovering = useHover(ref, () => console.log('callback'));

Demo ​

Api ​

Parameters

NameTypeDefaultNote
targetTarget-The target element to be hovered
callback?() => void-The callback function to be invoked on mouse enter

Returns

boolean

Parameters

NameTypeDefaultNote
targetTarget-The target element to be hovered
options.onEntry?() => void-The callback function to be invoked on mouse enter
options.onLeave?() => void-The callback function to be invoked on mouse leave

Returns

boolean

Parameters

NameTypeDefaultNote
callback?() => void-The callback function to be invoked on mouse enter

Parameters

NameTypeDefaultNote
options.onEntry?() => void-The callback function to be invoked on mouse enter
options.onLeave?() => void-The callback function to be invoked on mouse leave

Contributors ​

Source • Demo