<div id="root"></div>
function Select() {
  function handleSelect(e) {
    alert(`"${e.target.value}" selected`);
  }
  return (
    <select onChange={handleSelect}>
      <option value="avocado">Avocado</option>
      <option value="carrot">Carrot</option>
      <option value="potato">Potato</option>
      <option value="banana">Banana</option>
    </select>
  );
}

ReactDOM.render(<Select />, document.getElementById("root"));
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/react/17.0.1/umd/react.production.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.1/umd/react-dom.production.min.js