Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

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

Comments

Sign in to join the discussion.

MIT Licensed