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

138
Visualizações
React map inside map cloning on re-render

So I am rendering a map:

{categories.map((category, index) => {

and inside this map I am rendering another:

{challenges.map((challenge, index) => {

and they all render correctly but for example once I delete a challenge and call the getChallenges() (gets the challenges from server) which is what I also call at the first render with useEffect() it renders the categories properly but the challenges map inside the categories map gets doubled so I have the old & new ones. Anyway to prevent this or any way I can render the categories map and then the challenges map appending them to their correct category? Thanks for your help in advance I hope I was clear!

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

0

Solved because I was passing in an object as the 'key' so it was just [Object, Object] which made it not unique. Fixed by switching to challenge._id

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