Skip to main content
100%

Rendering CSV named colors with React

✓ Published1🌍 Public
IIlgar Akalın
Last edited Oct 4, 2021
Created on Oct 4, 2021

This example visualizes the 148 CSS named colors as horizontal color bars stacked vertically, with each bar’s background color set from the CSV’s “RGB hex value” column. It demonstrates unidirectional data flow in React, loading the dataset via D3’s `csv` utility inside a `useEffect` hook and managing the async result with `useState`. The app renders a “Loading…” message until the data arrives, then maps each row to a styled `<div>` element, with mouse events available for user interaction. The code uses React 16.13.1, ReactDOM, and D3 v6.

AI-generated description

Loading CsV data in React

Includes:

  • Mouse events
  • Unidirectional Data Flow
  • The notion of "State"
  • React's useState hook

A program that loads in some data from MDN: css named colors using D3 utilities, and uses React to render the data.

MIT Licensed

Similar vizzes