🌍 Public
Viewing a saved revision (read-only)
c4662823b70c4281943ca75ef0b4236c
Menu
A dropdown menu lets the user choose one of six pets: dog, cat, hamster, parrot, spider, or goldfish. The menu is built with D3’s data join, binding each option’s value and label to an HTML `<select>` element. The selected value is stored in a state object and passed to the `menu` function, which uses D3’s `.on('change')` to update the state and re-render the visualization. The example demonstrates a reusable menu component pattern with `select` and `join`, driven by a simple state management loop.
AI-generated description