Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
If no data is coming, the div should not appear

Sometimes the data may not come from the backend. I don't want to show div when data is not coming. how can I do it?

<div className="policydetailinformation__item">
 <h3>{t('policy.policy-details.address')}</h3>
 <p>{props.location.state.policy.information}</p>
</div>

I tried to put "ngIf" and got an error like this: Expected corresponding JSX closing tag for 'div'.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Just make a conditional class

<div className={youdata===null?"hidden":"policydetailinformation__item"}>
 <h3>{t('policy.policy-details.address')}</h3>
 <p>{props.location.state.policy.information}</p>
</div>

give a hidden class a display none property

about 4 years ago · Juan Pablo Isaza Report

0

Set the condition and && then your div

{showDiv && <div>
....
</div>
}
about 4 years ago · Juan Pablo Isaza Report

0

{
  const addr =  t('policy.policy-details.address');
  const isData = !!addr
  return addr ? (
    <div className="policydetailinformation__item">
     <h3>{addr}</h3>
     <p>{props.location.state.policy.information}</p>
    </div>
  ) : null
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!