Skip to main content
100%

Ep14 Interaction with React

✓ Published1🌍 Public
GGordon Yang
Last edited Apr 7, 2021
Created on Apr 7, 2021

This example shows a single circle rendered in SVG that follows the mouse cursor across a 960 by 500 canvas. The circle’s position updates in real time based on the pointer’s client coordinates. Built with React, it uses the `useState` and `useCallback` hooks to manage and update the mouse position state. The `onMouseMove` event handler on the SVG element triggers the state change, and ReactDOM renders the circle element with dynamic `cx` and `cy` attributes.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes