🌍 Public
Viewing a saved revision (read-only)
8badec3199fb4887a4ca800edfd3832c
Menus with React
This example demonstrates a pet-selection menu built with React and a reusable Dropdown component. It shows how React state manages the chosen option, displaying a label and a styled `<select>` element. The code uses React’s `useState` hook to track the selected value, initializing it to "hamster," and passes options as an array of value-label pairs to the Dropdown component. ReactDOM renders the App to the DOM, while the Dropdown’s `onChange` event updates state via a callback prop.
AI-generated descriptionReact starter code.