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

React - conditional example

0 votes
53 views
added Jul 6 in React by LC Marshal Captain (25,840 points)
const listingStreet = data.field_prop_street_t
    ? data.field_prop_street_t
    : '';
  const listingDistrict = data.district_s_lower ? data.district_s_lower : '';
  const listingState = data.state_s_lower ? data.state_s_lower : '';
  const fullAddress = `${listingStreet ? `${listingStreet}, ` : ''}${
    listingDistrict ? `${listingDistrict}, ` : ''
  }${listingState ? `${listingState}` : ''}`;

 

<p className="listing-address">
  {/* {listingStreet}, {listingDistrict}, {listingState} */}
  {fullAddress}
</p>

 

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.
...