Created
November 3, 2019 11:29
-
-
Save pubudu-ranasinghe/5519be3daff0ef9359932493434c5992 to your computer and use it in GitHub Desktop.
react-context-example-14
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"; | |
export default function Login() { | |
const [name, setName] = useState(""); | |
const [loading, setLoading] = useState(false); | |
function handleLogin() { | |
// Handle login here | |
} | |
if (loading) return <p>Loading..</p>; | |
return ( | |
<header className="App-header"> | |
<h2>Login</h2> | |
<div className="Item"> | |
<input | |
type="text" | |
placeholder="Name" | |
value={name} | |
onChange={e => setName(e.target.value)} | |
></input> | |
<button onClick={handleLogin}>Login</button> | |
</div> | |
</header> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment