🌍 Public
Viewing a saved revision (read-only)
cc10fb3a50804127bab828bdd3475824
Loading Data with React and D3
Aangelathacker123
Last edited Feb 9, 2022
Created on Feb 9, 2022
This example demonstrates how to load and summarize CSV data asynchronously using React and D3. It fetches the CSS named colors dataset from a GitHub gist via D3's `csv` function, storing the result in React state with the `useState` and `useEffect` hooks. The rendered view displays a plain-text summary of the loaded data, including size in kilobytes, row count, and column count, calculated using `d3.csvFormat`. Until the data arrives, a “loading” message appears.
AI-generated descriptionA program that loads in the data using D3 utilities, and uses React state to keep track of that data.