I have a "photos" array of "photo" object. Each "photo" object has a property value for the image url.
I try to iterate over the "photos" array with map(), in this way
photos.map((photo, index) => {
console.log(photo)
console.log(photo.value)
return (
<img
key={index}
src={photo.value}
className={index === active ? 'active' : ''}
alt="thumbnail"
/>
)
})
For some reason that I'm completely missing, photo.value is not available.
This is what those two console.log print out:
It seems the object is available, but then the "value" property returns undefined.
This was supposed to be very simple but I'm completely stuck at this point.
How can this be possible? What am I missing here?
Thanks
photo.photo.value, you print thephotoobject, but that itself is an object with a "photo" propertyphotocallback parameter to sayitem, then you would haveitem.photo.value, and that would just make more sense, thanphoto.photo. Alternatively you could destructure the photo param,..photos.map(({photo}, index) =>