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

149
Views
How to condtionally check two condtions within a JSX expression?

I am trying to test the validity of two condtions within a jsx expression within react. However, when I add my second expression to check for, I don't get an expected result. Rather, recieve the result of the expression as a 0 or 1 value.

This is my Current JSX:

{expression1 && (
  <button>Click me!</button>
)}

This is what I want, but this does not render correctly.

{expression1 & expression2  && (
  <button>Click me!</button>
)}

There must be a proper way to fix this. I am thinking that this is a syntactical issue.

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

0

You seem to have forgotten to use the double ampersand operator:

{expression1 && expression2 && (
  <button>Click me!</button>
)}
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!