Skip to main content
100%

Mouse Follower

✓ Published0🌍 Public
Rrstrauss127
Last edited Mar 28, 2022
Created on Mar 28, 2022

A single black circle follows the mouse cursor across an SVG canvas. The example demonstrates how React manages dynamic state alongside D3’s rendering environment. Using React’s `useState` and `useCallback` hooks, the component tracks mouse coordinates from the SVG’s `onMouseMove` event and updates the circle’s `cx` and `cy` attributes. The circle is rendered via React’s JSX, while D3 v5 is loaded but not directly used for interaction; the visualization relies entirely on React’s state updates to redraw the SVG element in real time.

AI-generated description

A program that follows your mouse with a circle

MIT Licensed

Similar vizzes