Last active
April 3, 2020 15:52
-
-
Save RichardBray/b267fab228c235cf9845537d9c603bd2 to your computer and use it in GitHub Desktop.
Enzyme test doc 1 test
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
// App.jsx | |
import React, { Fragment } from "react"; | |
// - Data | |
import data from "./data.json"; | |
export default function App() { | |
function renderQuestions() { | |
return data.results.map((result, index) => ( | |
<Question key={index} {...{result, index}} /> | |
)); | |
} | |
return ( | |
<Fragment> | |
<section> | |
<h1>Video games</h1> | |
<h2>How much you know about them?</h2> | |
<Button text="Let's go!" func={() => scrollToElem("question-0")} /> | |
</section> | |
{renderQuestions()} | |
<section> | |
<h3>Well done!</h3> | |
<h4> | |
You scored {calculateResult(correctAnswers, chosenAnswers)} out of {totalQuestions} | |
</h4> | |
<Button text="start over" func={() => window.location.reload()} /> | |
</section> | |
</Fragment> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment