Created
June 23, 2019 22:25
-
-
Save jsmanifest/03f88209f46d584a29580de893a99d33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = () => { | |
const [name, setName] = useState('') | |
const [gender, setGender] = useState('Male') | |
const onNameChange = (e) => setName(e.target.value) | |
const onGenderChange = (e) => setGender(e.target.value) | |
return ( | |
<div> | |
<form className="form"> | |
<div> | |
<input | |
onChange={onNameChange} | |
value={name} | |
type="text" | |
name="name" | |
placeholder="Friend's Name" | |
/> | |
</div> | |
<div> | |
<select onChange={onGenderChange} name="gender" value={gender}> | |
<option value="Male">Male</option> | |
<option value="Female">Female</option> | |
<option value="Other">Other</option> | |
</select> | |
</div> | |
<div> | |
<button type="submit">Add</button> | |
</div> | |
</form> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment