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

102
Views
Función de mapa de refactorización para que se devuelva una cadena en su lugar

Tengo un componente React que consume los objects de valor, lo que nos da acceso a una matriz, pero actualmente, el uso de la función de mapa devolverá una matriz de etiquetas/asistentes en lugar de solo un valor de cadena. ¿Alguien puede ayudarme? Lo mejor sería refactorizar este código para reflejar este cambio. La implementación actual devuelve los valores correctos, pero no estoy seguro de que sea el uso correcto de map.

 const FirstRepeatAttributeLabelAssistant = ({ objects, className }: Props) => { if (objects.length === 0) { return null; } let label = objects[0].attributeCollection.questions.map((question) => { return question._contributions.label; }); let assistant = objects[0].attributeCollection.questions.map((question) => { return question._contributions.assistant; }); return ( <StyledGroup as={Row}> <StyledLabelWrapper>{label}</StyledLabelWrapper> <Column size={12} /> <Column> <StyledAssistantWrapper>{assistant}</StyledAssistantWrapper> </Column> </StyledGroup> ); };

Esta es la matriz en cuestión:

ingrese la descripción de la imagen aquí

Entonces, realmente solo quiero asignar mi etiqueta de valores y asistente a aquellos en esta matriz.

Salida actual cuando console.log(labely); :

ingrese la descripción de la imagen aquí

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!