Skip to content

Commit

Permalink
removed conditional checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kirontoo committed Jun 17, 2021
1 parent ff0df3d commit 9b472d8
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/components/Signup/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@ const Signup = () => {

const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
const { name, value } = event.target;
if (name == "email") {
setForm( current => {
return { ...current, email: value };
});
} else {
setForm( current => {
return { ...current, password: value };
});
}
setForm( prevState => ({
...prevState,
[name]: value
}));
};

const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
// prevent page reload
event.preventDefault()
// request to server create a new user here
console.log(form);
}

return (
Expand Down

0 comments on commit 9b472d8

Please sign in to comment.