Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
Using map function to create React components

I want to map over values and return an instance of my <FirstRepeatAttributeLabelAssistant /> for every label (basically to render an label above each input, number of inputs can vary).

I've started off with this:

{object.attributeCollection.questions.map((question) => (
   <FirstRepeatAttributeLabelAssistant />
))}

The output of the map above is like so:

[StringAttributeModel, MemoAttributeModel, LabelAttributeModel, MemoAttributeModel, StringAttributeModel, StringAttributeModel] I only care about the "StringAttributeModel" as each of those 3 include 3 different labels (the part I care about). Their structure is like so:

enter image description here

How can I update my logic to ensure all of the potential labels are covered and a <FirstRepeatAttributeLabelAssistant /> component is rendered for each of them?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Suppose all your elements are a component, then you can simply do.

{object.attributeCollection.questions.map(Comp => {
  ...
  return <Comp label="..." />
})}

You can fill whatever your custom logic in the ... area.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda