Skip to main content
100%

Mouse Follower

✓ Published1🌍 Public
Yyejichun@naver.com
Last edited Sep 9, 2022
Created on Sep 6, 2022

A React-controlled SVG circle follows the mouse cursor across a fixed 960×500 viewport. Mouse coordinates are captured by the SVG’s `onMouseMove` event, processed via a `useCallback` hook, and stored in React state with `useState`. Each movement updates the circle’s `cx` and `cy` attributes, causing a re-render. The example demonstrates direct state-driven SVG updates without D3-specific interaction APIs, relying solely on React’s event handling and DOM reconciliation.

AI-generated description

A program that follows your mouse with a circle.

MIT Licensed

Similar vizzes