🌍 Public
Viewing a saved revision (read-only)
bd04fafe36524d6fb0e3503f6fe59a14
Load data into React
This example demonstrates how to load a dataset of CSS named colors into a React application using D3’s `csv` method, with React state managing the fetched data. The app displays basic metadata about the dataset, including its size in kilobytes, row count, and column count. It uses React hooks (`useState` and `useEffect`) to handle asynchronous data loading and rendering, with D3 v5 and React 16.9 loaded via UMD scripts. The visualization outputs plain text statistics in a `<pre>` element, switching from a “loading” message to the formatted summary once data arrives.
AI-generated descriptionA program that loads in some data about CSS named colours with d3 and uses react state to keep track of data