Function useMousePosition

  • Get the X and Y coordinates of the mouse cursor

    Example

    const MyComponent = () => {
    const [x, y] = useMousePosition();
    return <div>Mouse is at [{x}, {y}]</div>
    }

    Returns Coordinates

    Tuple with X and Y coordinates

Generated using TypeDoc