Select with React
✓ Published1🌍 Public
This example demonstrates a simple pet-selection dropdown built with React and ReactDOM. It shows how a controlled `<select>` element updates its displayed label when a user chooses a new option from the list of six animals. The App component uses the `useState` hook to track the selected value, passing it down to a reusable Dropdown component that maps over the options array. The dropdown’s `onChange` event triggers `setSelectedValue`, and the selected attribute highlights the current choice, with the initial value set to hamster.
AI-generated descriptionHalf way towards a smiley face.
MIT Licensed