Get the X and Y coordinates of the mouse cursor
const MyComponent = () => { const [x, y] = useMousePosition(); return <div>Mouse is at [{x}, {y}]</div>} Copy
const MyComponent = () => { const [x, y] = useMousePosition(); return <div>Mouse is at [{x}, {y}]</div>}
Tuple with X and Y coordinates
Generated using TypeDoc
Get the X and Y coordinates of the mouse cursor
Example