How to get selected value of a dropdown menu in ReactJS

后端 未结 9 1919
迷失自我
迷失自我 2020-12-04 10:03

I\'m using react and I want to get the value of the selected option of a dropdown in react but I don\'t know how. Any suggestions? thanks! My dropdown is just a select like:

9条回答
  •  抹茶落季
    2020-12-04 10:55

    Using React Functional Components:

    const [option,setOption] = useState()
    
    function handleChange(event){
        setOption(event.target.value)
    }
    
    
    

提交回复
热议问题