Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

7f65a8fb040d4367ba5a367caa10677d

Mouse Follower

0 stars1🌍 Public
AAleksandra Timofejeva
Last edited Jun 25, 2021
Created on Jun 25, 2021

A yellow SVG circle follows the cursor across a 960 by 500 canvas. The example demonstrates interactive state management in React, using a `useState` hook to track mouse coordinates and update the circle’s position on every move event. The SVG element listens for `onMouseMove`, and React DOM renders the circle’s `cx` and `cy` attributes based on the stored position. The code relies on React 16.9 and ReactDOM, with the SVG markup embedded directly in the JavaScript.

AI-generated description

Mouse follower.