Loading data with React
A React component loads a CSS named colors CSV and displays a text summary of the dataset. The code uses React’s useState and useEffect hooks, along with d3.csv, to fetch and store the data asynchronously, rendering a “loading” message while pending. The summary shows the file size in kilobytes, row count, and column count, calculated using d3.csvFormat and array properties. The visualization is plain text, rendered inside an HTML pre element.