Basic React Hook Test (Circles - Fixed Data)
✓ Published1🌍 Public
This example demonstrates how React hooks can manage D3-driven SVG circle updates with fixed data. The app initializes an array of seven values, rendering each as a grey circle with a blue stroke, positioned via attributes calculated from the data. Two buttons trigger state changes: “Update Data” adds five to every value, while “Filter Data” removes values above 35, causing D3’s join method to add, remove, or update circles accordingly. The code uses the `useRef`, `useState`, and `useEffect` hooks, alongside `d3.select` and `.join()`, with React 16.12 and D3 v5.
AI-generated descriptionFollowing along with Muri's basic tutorial on how to set up React hooks with D3.
MIT Licensed