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

React - if element is empty or not present

0 votes
42 views
added Jun 28 in React by lcjr Second Warrant Officer (6,120 points)
const wolfBoxes = data?.result?.field_prop_wolfboxes?.und?.[0]?.value ?? '';

{wolfBoxes && (
  <div className="detailItem"> 
      <span>
        <img
        src="/images/wolfbox.png" 
        css={css`
        width: 19px;
        height: 19px;
      `}
      alt="wolf box"
      />
    </span>
    <span>{`${wolfBoxes} boxes`}</span> 
  </div>
)}

 

Please log in or register to response this reference.

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