diff --git a/src/Home.js b/src/Home.js index afa7452a0..45ca0bf9a 100644 --- a/src/Home.js +++ b/src/Home.js @@ -1,29 +1,53 @@ import "./App.css"; import { useState, useEffect } from "react"; import { NavLink } from "react-router-dom"; +import { useHistory } from "react-router-dom"; function Home() { const [text, setText] = useState(""); const [isReady, setIsReady] = useState(false); + const history = useHistory(); + + const handleChange = (e) => { + setText(e.target.value); + validate(); + } + + const validate = () => { + const msg = text + '!' + if (msg !== "Ready!") { + setIsReady(false); + } else { + setIsReady(true) + setText(""); + } + } + + const redirect = () => { + history.push('/pokedex'); + } return (
Are you ready to be a pokemon master?
- - I am not ready yet! + + {!isReady && I am not ready yet!}