🌍 Public
Viewing a saved revision (read-only)
619540234616491cbd181e6531dc882e
General Update Pattern
This example demonstrates the D3 general update pattern with React, using a row of fruit shapes that change over time. It shows how data joins handle enter, update, and exit selections as apples are eaten and replaced by lemons. The code uses `selection.data()` with a key function, `.enter()`, `.merge()`, and `.exit()` to manage SVG groups, circles, and text elements. D3’s `scaleOrdinal` maps fruit types to colors and radii, while `setTimeout` triggers state changes to the fruit array.
AI-generated descriptionA bare minimum HTML page.
See also React Starter.