🌍 Public
Viewing a saved revision (read-only)
b2ac395f886244deb8b1439fdef4ea26
Menus with React
This example demonstrates a simple pet-selector interface built with React, where a user can choose a pet from a dropdown menu and the selection is logged to the console. The page starts with the hamster option preselected. The code defines a reusable `Dropdown` component that renders an HTML `<select>` element, mapping over a hardcoded list of options. State management is handled through React’s `useState` hook, with the current value passed back via an `onSelectedValueChange` callback. It utilizes React 16.9 and ReactDOM directly from unpkg CDN.
AI-generated descriptionReact starter code.