skip to Main Content

How to create a dropdown menu using react js is this is a right to set a value after this how to approach this – Html

const [selectedDepartment, setSelectedDepartment] = useState(""); const DepartmentDropdown = () => { const handleSelectChange = (event) => { setSelectedDepartment(event.target.value); }; const handleSubmit = (e) => { e.preventDefault(); console.log(email); }; return( <div> <label htmlFor="departments">Select a Department:</label> <select id="departments" value={selectedDepartment} onChange={handleSelectChange} > <option…

VIEW QUESTION
Back To Top
Search