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

87
Views
Operador que agrega la extensión correcta al atributo <etiqueta>

Tengo dos funciones que establecen valores diferentes. En el marcado, ¿cómo configuro el atributo para que tenga la extensión correcta? Sé cómo hacer esto con el operador ternario estándar, pero no quiero copiar el mismo código para todo lo que está debajo del atributo, ya que está envuelto dentro de él.

 const labelAttributes = ['checkbox'].includes(type) ? keyboardEvents({ space: () => helpers.setValue(!field.value) }) : null; const labelAttributesRadio = ['radio'].includes(type) ? keyboardEvents({ space: () => helpers.setValue(value) }) : null; return ( {type == 'radio' ? ( <label {...labelAttributesRadio}> ) : ( <label {...labelAttributes}> )} // Removed a lot more content but don't want to have to copy it twice within the operator <Field> </Field> <span> </span> </label>

)

about 4 years ago · Juan Pablo Isaza
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!