Skip to main content
100%

React Hooks Bowl of Fruit

✓ Published0🌍 Public
Mmsygnowski
Last edited Sep 4, 2019
Created on Sep 2, 2019

A static bowl of five apples demonstrates React Hooks for state management in a D3-based SVG visualization. The `FruitBowl` component maps fruit data to circles positioned along a row, using `scaleOrdinal` color and radius scales to differentiate apple from lemon. Clicking a fruit updates the `selectedFruit` state, highlighting the chosen circle with a black stroke. The example uses React's `useState` hook, D3's `range` for data generation, and renders purely via SVG, with no animation or transitions active in the final code.

AI-generated description

Trying out React Hooks.

MIT Licensed

Similar vizzes