React - add loop from API

0 votes
270 views
added Sep 14, 2022 in React by lcjr First Warrant Officer (11,780 points)
const { result } = ColumnMainData;

let coworkAmenities = get(ColumnMainData, 'result.field_prop_additional_amenities.und[0].value', '',
  );
coworkAmenities = coworkAmenities ? coworkAmenities.split(',') : [];
  
{!!coworkAmenities.length && (
  <div className="co-working col-md-12 detail-info order-3">
    <div className="facilities-prop">
      <h1>Amenities</h1>
      <div className="row">
        <div className="col-md-12">
          <div className="list-icon">
            <ul className='li_loop col3'>
              {coworkAmenities.map(index => (
                <li key={index} className="media facilities-list-item">
                  {/* <img
                    src="/static/images/vpm/icon/Checkbbox.svg"
                    className="ul-done"
                    alt="done"
                  /> */}
                  <div className="media-body">
                    {/* <h5 className="mt-0 mb-1">List-based media object</h5> */}
                    {index}
                  </div>
                </li>
              ))}
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
)}

 

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