Skip to main content
100%

Moving the mouse around

✓ Published0🌍 Public
MManuel Bauer
Last edited Aug 29, 2022
Created on Aug 29, 2022
Forked from Smiley Face Part 1

A black circle follows the mouse as it moves across an SVG canvas. The example demonstrates how to use React state to track cursor position and update a visualization in response to user interaction. The `App` component uses React's `useState` hook to store the circle's coordinates, and the `onMouseMove` event on the `<svg>` element updates that state with `event.clientX` and `event.clientY`. The circle is rendered as an SVG `<circle>` element with its `cx` and `cy` attributes bound to the state values.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes