🌍 Public
Viewing a saved revision (read-only)
e6880b3eb5394f45907c9f01316973cf
Mouse Follower
A yellow circle follows the mouse cursor across an SVG canvas. The example demonstrates real-time interaction in a React application, using state management to track the cursor's coordinates. The code builds an SVG with React's `useState` and `useCallback` hooks, updating the circle's `cx` and `cy` attributes on every `onMouseMove` event. The React component renders directly into a `div` element, with the SVG's default styling coming from D3 v5 and React 16.9.0.
AI-generated descriptionA program that follows the mouse with a circle.