🌍 Public
Viewing a saved revision (read-only)
8a2e02118b854f9bb0efef05f73cf323
Menus with React
This example demonstrates a pet-selection dropdown menu built with React. It shows how a controlled `<select>` element updates a displayed value based on user interaction. The code defines a reusable `Dropdown` component that receives options, a selected value, and a change handler, using React hooks (`useState`) to manage state. The interface renders a large label and select box, with the chosen pet name reflected instantly. It uses React and ReactDOM to mount the app, with the dropdown options defined as a static JavaScript array of pet names.
AI-generated descriptionReact starter code.