π Public
Viewing a saved revision (read-only)
f4457e1652f641bb98a18049ae2c70a7
Menus with React
This example demonstrates a simple pet-selection menu built with React, where users choose from six predefined animal options and the current selection is logged to the console. The interface uses a native HTML `<select>` element wrapped in a reusable `Dropdown` component, which receives `options`, `selectedValue`, and an `onSelectedValueChange` callback via props. The App component manages state with the `useState` hook, initializing the selection to "hamster". ReactDOM renders the component tree, while React production builds are loaded from a CDN to support the interactive behavior.
AI-generated descriptionReact starter code.