useHover ​
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
Name | Type | Default | Note |
---|---|---|---|
target | Target | - | The target element to be hovered |
callback? | () => void | - | The callback function to be invoked on mouse enter |
Returns
boolean
Parameters
Name | Type | Default | Note |
---|---|---|---|
target | Target | - | 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
Name | Type | Default | Note |
---|---|---|---|
callback? | () => void | - | The callback function to be invoked on mouse enter |
Returns
Parameters
Name | Type | Default | Note |
---|---|---|---|
options.onEntry? | () => void | - | The callback function to be invoked on mouse enter |
options.onLeave? | () => void | - | The callback function to be invoked on mouse leave |