Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

95
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda