Last active
May 16, 2021 22:59
-
-
Save bsitruk/504ac508f4a0158a77456a1d05368d5c to your computer and use it in GitHub Desktop.
This file contains 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
<form | |
ref={formRef} | |
onSubmit={(e: React.SyntheticEvent) => { | |
e.preventDefault(); | |
const target = e.target as typeof e.target & { | |
email: { value: string }; | |
password: { value: string }; | |
}; | |
const email = target.email.value; // typechecks! | |
const password = target.password.value; // typechecks! | |
// etc... | |
}} | |
> | |
<div> | |
<label> | |
Email: | |
<input type="email" name="email" /> | |
</label> | |
</div> | |
<div> | |
<label> | |
Password: | |
<input type="password" name="password" /> | |
</label> | |
</div> | |
<div> | |
<input type="submit" value="Log in" /> | |
</div> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment