The goal: hide the number of correct answers if the student hasn’t answered any questions yet.
Why doesn’t &&
work as expected here?
Code with error
function QuizStatus({ numAnswered, numCorrect }) {
return (
<div>
<p>Total answered: {numAnswered}</p>
{numAnswered &&
<p>Total correct: {numCorrect}</p>}
</div>
)
}