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

249
Views
¿Cómo anidar if-else dentro de un if en la sintaxis JSX usando ternario?

Estoy tratando de lograr lo siguiente en JSX:

 if (declineButtonMessage) { if (buttonDirection === 'column') { render button 1 } else { render button 2 } }

Tengo esto hasta ahora:

 {declineButtonMessage && ( )}

Y traté de contrabandear esto adentro:

 buttonDirection === 'column' ? <StyledDeclineButton buttonDirection={buttonDirection} title={declineButtonMessage} wide onPress={onSecondaryAction} /> : <SecondaryButton buttonDirection={buttonDirection} title={declineButtonMessage} wide onPress={onSecondaryAction} />

Pero no estaba funcionando y mi linter se estaba volviendo loco. Me imagino que estoy haciendo algún tipo de error de sintaxis JSX

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

0

esto debería ayudarte

 { declineButtonMessage ? (buttonDirection === 'column' ? <button1 /> : <button2 />) : null }
about 4 years ago · Juan Pablo Isaza Report

0

{!!declineButtonMessage && (buttonDirection === 'column' ? <button1 /> : <button2 />)}

Prueba esto por favor

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!