-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathHome.js
More file actions
49 lines (44 loc) · 1.33 KB
/
Home.js
File metadata and controls
49 lines (44 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import "../../App.css";
import { useState, useEffect } from "react";
import { NavLink } from "react-router-dom";
function Home() {
const [text, setText] = useState("");
const [isReady, setIsReady] = useState(false);
const InputHandler = (event) => {
setText(event.target.value);
if (event.target.value === "Ready!") {
setIsReady(true);
}
if (event.target.value !== "Ready!"){
setIsReady(false)
}
};
return (
<div className="App">
<header className="App-header">
<NavLink to="/auth">
<img
hidden={!isReady}
src="https://www.freeiconspng.com/uploads/file-pokeball-png-0.png"
className="App-logo"
alt="logo"
style={{ padding: "10px" }}
/>
</NavLink>
<b>
Requirement: Try to show the hidden image and make it clickable that
goes to /pokedex when the input below is "Ready!" remember to hide the
red text away when "Ready!" is in the textbox.
</b>
<p>Are you ready to be a pokemon master?</p>
<input type="text" name="name" onChange={InputHandler} value={text} />
{isReady ? (
""
) : (
<span style={{ color: "red" }}>I am not ready yet!</span>
)}
</header>
</div>
);
}
export default Home;