From 7b044b44878898cd7844d20385d6788b8f97c19c Mon Sep 17 00:00:00 2001 From: Jack Meier Date: Mon, 24 Aug 2020 11:54:06 -0700 Subject: [PATCH] added code to conditionally render correct/incorrect --- client/src/components/Quiz/index.js | 1 - client/src/pages/Home/index.js | 1 - client/src/pages/Results/ResultCard.js | 14 ++++++++------ client/src/pages/Results/Results.js | 2 -- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/client/src/components/Quiz/index.js b/client/src/components/Quiz/index.js index df8a209..3350800 100644 --- a/client/src/components/Quiz/index.js +++ b/client/src/components/Quiz/index.js @@ -34,7 +34,6 @@ function Quiz() { countryArr.current[Math.floor(Math.random() * countryArr.current.length)]; if (questionCount <= 5) { quizArr.push(randomCountry); - console.log(quizArr); } answerList.push(answerFromMap); setCountry(randomCountry); diff --git a/client/src/pages/Home/index.js b/client/src/pages/Home/index.js index eda4057..12a44e8 100644 --- a/client/src/pages/Home/index.js +++ b/client/src/pages/Home/index.js @@ -39,7 +39,6 @@ function Home() { let data = "Continent Not Found"; if (results.length !== 0 && results.length !== "undefined") { for (let i=0;i< results.length;i++){ - console.log("continent",continent) let result = results[i]; if(result.hasOwnProperty(continent)){ data = "Continent Found" diff --git a/client/src/pages/Results/ResultCard.js b/client/src/pages/Results/ResultCard.js index 8fda5d1..a3d64ba 100644 --- a/client/src/pages/Results/ResultCard.js +++ b/client/src/pages/Results/ResultCard.js @@ -1,16 +1,18 @@ import React from "react"; import ResultsFacts from "./ResultsFacts"; -function ResultCard(props) { - console.log(props); - +function ResultCard({ country, status }) { return (
-
{props.country}
- Correct - +
{country}
+ {status === "Correct" ? ( + Correct + ) : ( + Incorrect + )} +
diff --git a/client/src/pages/Results/Results.js b/client/src/pages/Results/Results.js index 5651841..c4902c0 100644 --- a/client/src/pages/Results/Results.js +++ b/client/src/pages/Results/Results.js @@ -25,8 +25,6 @@ function Results(props) { let status = "Incorrect"; for (let i = 1; i < guessedCountries.length; i++) { let countryStatus = guessedCountries[i]; - console.log("guessedList", guessedCountries); - console.log(country, countryStatus[country]); if (countryStatus[country] === "Correct") { status = "Correct"; return "Correct";