Created
June 11, 2020 07:10
-
-
Save YounglanHong/97563fdea3e6443767912e3e96c908a7 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 React, { useState } from "react"; | |
import "./hook.css"; | |
function Login() { | |
const [email, setEmail] = useState(""); | |
const [password, setPassword] = useState(""); | |
useEffect(() => { | |
console.log("useEffect1"); | |
}); | |
useEffect(() => { | |
console.log("useEffect2"); | |
}, []); | |
useEffect(() => { | |
console.log(email, password); | |
}, [email, password]); | |
function handleInputEmail(e) { | |
setEmail(e.target.value); | |
} | |
function handleInputPassword(e) { | |
setPassword(e.target.value); | |
} | |
return ( | |
<div className="login"> | |
<h2>Login</h2> | |
<input | |
className="email" | |
placeholder="email" | |
value={email} | |
onChange={handleInputEmail} | |
/> | |
<br /> | |
<input | |
className="password" | |
placeholder="password" | |
value={password} | |
onChange={handleInputPassword} | |
/> | |
</div> | |
); | |
} | |
export default Login; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment