🌍 Public
Viewing a saved revision (read-only)
05d5ca10a3c54fe283aa048837df214e
Loading Data with d3 & React
This example demonstrates how to load CSV data asynchronously in a React component using d3.csv, displaying the dataset’s size, column count, and row count in a large <pre> element. The React useState hook manages the fetched data, initially showing a “loading” message until the promise resolves. The code imports ReactDOM and d3’s csv parser directly from CDN links. The data originates from a GitHub gist containing CSS named colors. The output updates responsively once the fetch completes, converting the parsed CSV back to text with d3.csvFormat to calculate its kilobyte size.
AI-generated descriptionA program that follows your mouse movement