Created
November 3, 2022 04:18
-
-
Save Ralexs0096/45e8cbec2f58c09b0592c0f67fe453e4 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
import { useState } from 'react'; | |
const App = () => { | |
const [data, setData] = useState({ | |
username: '', | |
password: '', | |
}); | |
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | |
setData({ | |
...data, | |
[event.target.name]: event.target.value, | |
}); | |
}; | |
const onSubmit = () => { | |
// TODO: here you have to add the code | |
}; | |
return ( | |
<form onSubmit={onSubmit}> | |
<input | |
type="text" | |
placeholder="type your username" | |
name="username" | |
value={data.username} | |
onChange={handleChange} | |
/> | |
<br /> | |
<input | |
type="text" | |
placeholder="type your password" | |
name="password" | |
value={data.password} | |
onChange={handleChange} | |
/> | |
<hr /> | |
username: {data.username} | |
<br /> | |
password: {data.password} | |
</form> | |
); | |
}; | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment