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

94
Views
How to use AND and OR statement inside the component while comparing in react component

I'm unable to find proper syntax of the use of AND and OR using inside the component fragments. Lets say i have data which may return condition in strings

conditionOne
conditionTwo
conditionThree

I can use if statment like this

<React.Fragment>
  {data.condition === 'conditionOne' ? <>Do This </> : <> Do Something Else </>} 
<React.Fragment/>

But I want to find out the similar syntax to find, if all conditions meets Or one of the condition meets than Do Something Else or Do This .

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

0

You can do

['conditionOne', 'conditionTwo', 'conditionThree'].includes(data.condition)

this would replace the data.condition === 'conditionOne' expression.

You can also store that array somewhere else or use a Set.

A less maintainable approach would be to use the logical operators, but that can cause noise in the conditional ternary operation.

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!