1

I'm getting a 0 being rendered on the page when showScore is false

<div>
   { !isObjectEmpty(userReport) &&
     <div className={'data'}>
       {showScore && <span><FaTrophy/> {score}</span>}
     </div>
   }
</div>

CSS for this div

padding: 10px;
display: flex;
flex-direction: row;
justify-content: space-between;
font-size: 0.8em;
font-weight: bold;
background-color: rgba(255,255,255,0.5);

Any ideas why I would get a 0 in the page instead of nothing when showScore is false?

1 Answer 1

1

In case you're trying to display nothing instead of a 0, you might try this:

{ showScore ? (<span><FaTrophy/> {score}</span>) : '' }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.