🌍 Public
Viewing a saved revision (read-only)
eba0d18cbc8e40ecbb47bf2618dbad89
Menus with React
This example demonstrates a pet-selection menu built entirely with React, showing how dropdown state updates the displayed choice. It renders a labeled `<select>` element with five hard-coded options (goldfish, cat, hamster, spider, parrot) and initializes the selection to "hamster." The `Dropdown` component receives `options`, `selectedValue`, and an `onSelectedValueChange` callback, leveraging React’s `useState` hook to manage the selected value and update the UI on each change. The code uses React 16.9 and ReactDOM to mount the app, with custom styling applied via inline CSS.
AI-generated descriptionReact Starter Code