dv2020-ep30-viz31 - menus
✓ Published0🌍 Public
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 descriptionmenus in react
MIT Licensed