🌍 Public
Viewing a saved revision (read-only)
8bbe76cc1ea5474ca647800963d97dd9
Loading Data with React & D3
This example demonstrates how to load a CSV dataset and display its summary statistics as text, using React state to track the data as it loads asynchronously. The `d3.csv` function fetches the CSS named colors dataset from a GitHub gist, and a custom `message` utility calculates and formats the data’s size in kilobytes, row count, and column count. The app renders either a loading message or the summary using React’s `useState` and `useEffect` hooks, with the output displayed in a large monospace `<pre>` element rendered as SVG.
AI-generated descriptionA program that loads in some data using D3 utilities, and uses React state to keep track of the data.