🌍 Public
Viewing a saved revision (read-only)
304b491dce884906ba7ce963d9047ea4
Menus with React
This example shows a pet-selection menu built with React. It displays a dropdown list of six animal options, with a hamster preselected. The app uses React’s `useState` hook to track the selected value, which is logged to the console on change. The `Dropdown` component, defined in a separate file, maps over the option objects to render each `<option>` element, with the selected value triggering a change event. The page loads React and ReactDOM from unpkg and renders the app into the root div.
AI-generated descriptionReact starter code.