Skip to main content
100%

React Hooks Bowl of Fruit

✓ Published0🌍 Public
HHadi Boukdir
Last edited Jul 17, 2019
Created on Jul 17, 2019

Five apples rendered as red SVG circles sit in a row, with one selectable via click. React Hooks manage the fruit state and selected fruit ID, while d3 ordinal scales map fruit type to color and radius. The code uses React's `useState` hook, ReactDOM rendering, and d3's `scaleOrdinal` and `range` functions. The data is generated using `Math.random()` for fruit IDs, and clicking a circle triggers a stroke highlight, though no animation is implemented.

AI-generated description

Trying out React Hooks.

MIT Licensed

Similar vizzes