🌍 Public
Viewing a saved revision (read-only)
d675063974d14a21b57da1bd8573ea25
Loading data with React
This example demonstrates how to load and display CSV data in a React application, showing a text summary of the dataset size and structure. It uses React state (`useState`) to hold the fetched data and the `useEffect` hook to trigger the data loading. The code fetches a CSS named colors dataset via `d3.csv`, then formats the results with `d3.csvFormat` to count bytes, rows, and columns. A loading message appears until the data arrives, at which point the summary replaces it.
AI-generated descriptionA program that loads in some data using D3 utilities, and uses React state to keep track of the data.