Mouse Follower
✓ Published1🌍 Public
This example shows a single circle that follows the mouse cursor across an SVG canvas. Built with React and D3 v5, it uses React’s `useState` hook to track the cursor’s clientX and clientY coordinates on every `mousemove` event, then re-renders the circle’s `cx` and `cy` attributes to match. The `useCallback` hook memoizes the event handler, and the initial mouse position is set to the canvas center. The rendering uses ReactDOM to mount the SVG, with no external data source.
AI-generated descriptionA program that follows your mouse
MIT Licensed