showing results for - "get option value in react by usestate"
Salomé
05 Mar 2016
1const [addrtype, setAddrType] = useState('Home')
2
3function handleAddrTypeChange(e) {
4    setAddrType(e.target.value);
5    console.log(addrtype)
6}
7
8
9                            <select
10                                defaultValue={addrtype}
11                                onChange={handleAddrTypeChange}
12                                className="browser-default custom-select">
13                                <option selected value="1">Home</option>
14                                <option value="2">Marketing</option>
15                                <option value="3">Work</option>
16                                <option value="3">Head Office</option>
17                            </select>