const Form = () => {
const [value, setValue] = useState("grapefruit");
const handleChange = (event) => {
setValue(event.target.value);
}
return (
<form onSubmit={handleSubmit}>
<label>
Fav fruit
<select value={value} onChange={handleChange}>
<option value="grapefruit">Grapefruit</option>
<option value="apple">Apple</option>
</select>
</label>
</form>
)
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter