Skip to main content
100%

Rendering Data w- React

✓ Published1🌍 Public
Kkalmdown
Last edited Jul 29, 2021
Created on Jul 22, 2021

This example renders the CSS Named Colors dataset as a vertical stack of thin colored rectangles. Each row in the CSV file becomes a single div element, with its background color set from the dataset’s `RGB hex value` field, forming a 960-pixel-wide spray. The visualization is built with React, using the `useState` and `useEffect` hooks to asynchronously load the CSV via D3’s `csv` function, and then maps each record to a styled div. ReactDOM mounts the final component into the page’s root element, displaying all color swatches stacked without gaps.

AI-generated description

Before making a radial spray using CC Named Colors, getting them into DIVs.

MIT Licensed

Similar vizzes