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

145
Views
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 answers
Answer question

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 Report
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!