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

153
Vistas
How to solve the issue of Warning: Each child in a list should have a unique "key" prop even I am using key props

Here is my code

return (
    <ScrollView>
      <View style={{ padding: 10, flex: 1 }}>
        {listing.map((listing) => (
          <>
            <View style={styles.containerOne} key={listing.snome_id}>
              <View
                id="listing"
                style={styles.containerTwo}
              >
                <Text style={{ margin: 15, marginTop: 20 }}>
                  {listing.header}
                </Text>

                {listing.url.map((url) => (
                  <Image style={styles.pic} source={{ uri: url }} />
                ))}

                <Text style={{ margin: 15, marginTop: 20 }}>
                  {' '}
                  {listing.description}
                </Text>
              </View>
            </View>
          </>
        ))}
      </View>
    </ScrollView>
  );

I am trying to view multiple listings and the corresponding image and some text. It seems even though I am using a key prop in the view component it is still throwing error to me and I am not sure about the reason behind that.

I hope that somebody can help me to resolve this issue.

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

0

The key always needs to be given to the top-level component created by the map function. In your code, that's the Fragment. You'll need to replace this:

  <>
            <View style={styles.containerOne} key={listing.snome_id}>
 ...
  </>

With this:

  <React.Fragment key={listing.snome_id}>
            <View style={styles.containerOne}>
  ...
  </React.Fragment>
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