React - populate data conditionally; show this if exist, or else show this

0 votes
107 views
added Nov 14, 2024 in JSX by lcjr Lieutenant (12,120 points)

// else show that
{seoTitleWithAsset ? (
  <>{title}</>
) : (
  <> do this</>
)}

// if exist, show this
<h2>Overview</h2>
{seoTitleWithAsset && (
  <p>{title} </p>
)}

 

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