Skip to main content
100%

React & D3 Starter

✓ Published74🌍 Public
CCurran Kelleher
Last edited Feb 21, 2025
Created on Jun 5, 2022
Forked from HTML Starter

This example visualizes the Iris flower dataset as a scatter plot, mapping sepal length to the x-axis and petal length to the y-axis. The React application loads data via a custom `useData` hook that fetches a CSV with `d3.csv`. A `VizWrapper` component uses `useRef` and `useEffect` to decouple React from D3, passing scale functions from `d3.scaleLinear` and axis generators like `d3.axisLeft` and `d3.axisBottom` into a separate `viz` function for rendering SVG circles and gridlines.

AI-generated description

This viz is a starter that demonstrates patterns used in real world projects in which complexity is anticipated to scale.

  • Decoupled React & D3 integration
  • Opening moves for scalable complexity
  • Industry standard ES modules and JSX
  • Copy-paste into existing projects

Any questions? Ask on Twitter!

Also viewable in:

MIT Licensed

Similar vizzes