Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

React Interaction Template

Public visualization

Viewing a saved revision (read-only)

2999658e70044687a6e95287b631fc2f

React Interaction Template

0 stars1🌍 Public
AAndres de la Garza
Last edited Feb 28, 2021
Created on Feb 28, 2021

This example demonstrates a simple interactive template built with React and D3 v6, rendering an SVG circle that follows the mouse cursor across a 960×500 canvas. The app uses React’s `useState` and `useCallback` hooks to track and update the mouse position on every `mousemove` event, while the circle’s `cx` and `cy` attributes are bound directly to that state. The template shows how to combine React’s declarative component model with D3’s SVG primitives for real-time user interaction without explicit D3 selections or transitions.

AI-generated description

React Interaction Template