React - conditional rendering for show and hide when element is present

0 votes
87 views
added Jul 22, 2021 in React by lcjr First Warrant Officer (9,190 points)
<span
  css={css`
    background-image: url('/images/current-listings/bed.png');
  `}
>
  //Combine variable and HTML text
  {beds === 0 ? <>Studio</> : <>{`${beds} beds`} </>}
  
  //variable only 
  {beds === 0 ? <>Studio</> : <>{beds} </>}
</span>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...