challenges

JSX and the && Operator

The goal: hide the number of correct answers if the student hasnt 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>
  )
}