Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

220
Vistas
Each child in a list should have a unique "key" prop while nested list iteration

I have this React code:

export default function Technologies({ technologies }) {

  return (
    <>
      { Object.keys(technologies).map((key, i) => (
        <span>

          <span className={styles.post}><h3 className={'bold300'}>{key}</h3></span>

          <div className={styles.techList}>
            <ul key={i}>
              { Object.keys(technologies[key]).map((key2, idx) => (
                <li key={idx}>{key2}
                  { technologies[key][key2].map(key3 => (
                    <span key={key3.name} className={styles.badge}><Image src={key3.name} width={key3.w} height={key3.h} /></span>
                  )) }
                </li>
              )) }
            </ul>
          </div>

        </span>
      )) }
    </>
  )
}

Here you can see nested iteration, and everywhere I use i or idx to create unique key for list, but still keep getting warning for this string:

...
<ul key={i}>
...

As I said, I know what this error means, and even know how to fix, but not in this case, I just don't know, where I should put key to prevent this warning. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The key should be present on the root element. So, the first key should be on the span and not on the ul.

export default function Technologies({ technologies }) {
  return (
    <>
      {Object.keys(technologies).map((key, i) => (
        <span key={i}>
          <span className={styles.post}>
            <h3 className={"bold300"}>{key}</h3>
          </span>
          <div className={styles.techList}>
            <ul>
              {Object.keys(technologies[key]).map((key2, idx) => (
                <li key={idx}>
                  {key2}
                  {technologies[key][key2].map((key3) => (
                    <span key={key3.name} className={styles.badge}>
                      <Image src={key3.name} width={key3.w} height={key3.h} />
                    </span>
                  ))}
                </li>
              ))}
            </ul>
          </div>
        </span>
      ))}
    </>
  );
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda