Skip to main content
100%

Mouse follower

✓ Published1🌍 Public
WWaseem Medhat
Last edited Oct 16, 2020
Created on Oct 15, 2020
Forked from Menus

A single gray circle follows the mouse cursor across an SVG canvas. The example demonstrates how React state and event listeners coordinate with D3 rendering. The `App` component tracks pointer coordinates via an `onMouseMove` handler, storing them in `mousePosition` with `useState` and `useCallback`. On each update, React re-renders the circle using the new `cx` and `cy` properties. The visualization uses React 16.9 and D3 v6, importing only the `arc` function which remains unused in the final code.

AI-generated description

Event listener and React state.

MIT Licensed

Similar vizzes