useMouse ​
Hook that manages a mouse position
typescript
import { useMouse } from '@siberiacancode/reactuse';
Usage ​
typescript
const { x, y, elementX, elementY, elementPositionX, elementPositionY } = useMouse(ref);
// or
const { ref, x, y, elementX, elementY, elementPositionX, elementPositionY } = useMouse();
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
target | Target | - | The target element to manage the mouse position for |