Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

React - hide when data is null through conditional rendering &&

0 votes
43 views
added Apr 12 in React by lcjr Second Warrant Officer (6,120 points)
{agencyURL && (
  <span>
    <a className="agency-url" target="_blank" href={`http://${agencyURL}`}>{agencyURL}</a>
  </span>
)} 

 

2 Responses

0 votes
responded Apr 12 by lcjr Second Warrant Officer (6,120 points)
{agencyLogo && (
  <div
    css={css`
      display: inline-block;
      width: auto;
      margin-top: 8px;
      border-radius: 5px;
      overflow: hidden;
      padding: 0;
    `}
  >
    <img
      css={css`
        margin: 0 auto;
        height: 40px;
      `}
      src={agencyLogo}
      alt={agencyName}
    />
  </div>
)}

 

0 votes
responded Apr 16 by lcjr Second Warrant Officer (6,120 points)
{!isMobile && (
  <span>
   This content will appear for desktop and tab, not for mobile
  </span>
)} 

 

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