Skip to main content
100%

dv2020-ep30-viz31 - menus

✓ Published0🌍 Public
Zzach b.
Last edited Mar 22, 2023
Created on Mar 22, 2023

This example shows a React component that renders a dropdown menu for selecting a pet from a fixed list of options. The selected pet name appears as the dropdown’s current value, and the app manages that selection state with React’s `useState`. The `Dropdown` component maps over the `options` array to produce `<option>` elements, marking the selected one with the `selected` attribute, and triggers an `onChange` event to update the parent’s state via `onSelectedValueChange`. The code uses React 16.9 and a custom `Dropdown` functional component, with no external data source beyond the hardcoded list.

AI-generated description

menus in react

Episode 30

MIT Licensed

Similar vizzes