Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

76773772efd94430a369f8e545c4818d

Mouse Follower

0 stars1🌍 Public
NNicholas Francis O'Brien
Last edited Oct 5, 2022
Created on Oct 5, 2022

A React component tracks the mouse position within an SVG canvas using the `useState` and `useCallback` hooks, rendering a circle that follows the cursor. The `onMouseMove` event handler updates the circle's center coordinates via `setMousePosition`. The SVG circle updates its `cx` and `cy` attributes in real time, demonstrating reactive rendering with React 16.9 and ReactDOM.

AI-generated description

Program that follows your mouse with a circle