🌍 Public
Viewing a saved revision (read-only)
67ec132c22b9463a9762e01bb9019e85
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