I am very new to reactjs . I need handle the select option in my form . And set ne useStae correspond to select option and store the value of option on change event. But the problem is that when I select the first time any option then it gives me an empty string.
This is code
const [gender,setGender] = useState("")
const genderHandle = (e) =>{
setGender(e.target.value)
console.log(gender)
}
<select onChange={genderHandle}>
<option selected disabled>What is your gender?</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Unknown">Unknown</option>
<option value="Anther Gender">Another Gender</option>
</select>
output ""
Am I doing something wrong ?