Ravenous Project: part 2 (Warning: Each child in a list should have a unique "key" prop)

part 2 is working, but gives me this error

I got the exactly same Warning code.
I tried to resolve the issue.
The Warning(this is not an error) occured in the BusinessList.js file:
My first code was:

     this.props.businesses.map((business, index) => 
          <Business business={business}/>)

I needed to add a unique key property to the (Business /) and it is resolve the issue.

      this.props.businesses.map((business, index) => 
           <Business key={index} business={business}/>)

React always expects every list to have a key prop passed into it, i’d use the index of the map function

1 Like

Thank you for posting the solution :slight_smile:

To anyone searching for this warning: This solution works but just know that Ravenous Part 4 has a step that will fix the so it’s fine to ignore for now.