Loading Data with React and D3: Organized
This example demonstrates how to load and parse CSV data within a React application using D3. The Washington Post’s fatal police shooting dataset is fetched via `d3.csv`, with the resulting data stored in a React state hook. The interface displays a concise summary—file size in kilobytes, row count, and column count—computed using `d3.csvFormat`. The code separates data-loading logic, the main `App` component, and a utility `message` function into distinct files, highlighting an organized React structure.
AI-generated descriptionA program that loads and parses some CSV fatal police shooting data collected by the Washington Post on fatal police shootings in the US from 2015-present (Sept 9, 2020). The original data is updated in near real time and so may differ slightly from the data contained in this gist.
Additional information can be found at the study web page
Using D3 to load and React states to keep track of the data. In this version, individual components are separated into their own *.js files.