🌍 Public
Viewing a saved revision (read-only)
2c6ca9dca5fa4a14a5c857e37ce62eb8
Loading data with React and D3
This example demonstrates how to load and display a CSV dataset in a React application, showing a text summary of the data size, row count, and column count once the file is fetched. The code uses React’s `useState` and `useEffect` hooks to manage the asynchronous loading state, while D3’s `d3.csv` fetches the data from a GitHub gist URL and `d3.csvFormat` converts it back to a string to calculate its size in kilobytes. The visualization initially displays “Loading…” and updates to the summary once the data arrives.
AI-generated descriptionMouse follower