Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Rendering data with react

Public visualization

Rendering data with react

0 stars0🌍 Public
Bbryce-walsh
Last edited Apr 1, 2021
Created on Apr 1, 2021

This example renders the CSS named color palette as a vertical sequence of 960-pixel-wide, 4-pixel-tall color swatches, one per row. It shows how D3’s `csv` loader fetches the dataset from a GitHub gist, while React’s `useEffect` and `useState` manage the asynchronous data loading and render each row as a styled `<div>` in an SVG-capable layout. The code uses React 16.9, ReactDOM, and D3 6.6, with the raw CSV parsed for each color’s `RGB hex value` to set the background color. A simple loading state displays until the data arrives.

AI-generated description

Read in data using D3 and track using React

Comments

Sign in to join the discussion.

MIT Licensed