Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Loading Data with React & D3

Public visualization

Viewing a saved revision (read-only)

0d2fc2f708e2474b861dea6e8e3eaf68

Loading Data with React & D3

0 stars1🌍 Public
SSamirAhma
Last edited Nov 24, 2022
Created on Nov 24, 2022
Forked from Mouse Follower

This example shows a simple interactive visualization where a circle follows the mouse cursor across an SVG canvas. React state tracks the cursor's current x and y coordinates, updating the circle's `cx` and `cy` attributes on every mouse movement. The code combines React’s `useState` and `useCallback` hooks with ReactDOM to manage the UI, while the SVG scene renders a single circle element whose position is bound to the live mouse data. The interaction is driven by the `onMouseMove` event handler on the SVG, demonstrating direct state-to-rendering synchronization within a React-D3 pairing.

AI-generated description

A program that follows your mouse with a circle.