Fork of Mouse Follower
✓ Published0🌍 Public
This example shows a red circle that follows the mouse cursor inside an SVG canvas. The circle’s position is updated to the cursor’s client coordinates, with an initial position at the canvas center. The code uses React’s `useState` and `useCallback` hooks to manage and update the mouse position state, and ReactDOM renders the SVG element, which also includes a fixed red diagonal line, into the page. The SVG `onMouseMove` event handler triggers the position update.
AI-generated descriptionA program that follows your mouse with a circle.
MIT Licensed