I'm mapping a list of objects in my react app like follows
(countrydata !== null) ? Object.keys(countrydata).map((item, key) => {
return (
<img src={countrydata[item].image_location}/>
)
})
I also have an array which has the exact number of objects as in the list of objects i have mapped above. I want to display a certain data that is in the objects of the array and i tried doing something like this
(countrydata !== null) ? Object.keys(countrydata).map((item, key) => {
arrayOfObjects.map((arrayItem,key)=>{
return (
<div>
<img src={countrydata[item].image_location}/>
<span>{arrayItem.name}</span>
</div>
)
})
})
But couldn't achieve the result i wanted. How can i map the array of objects inside the mapping of objects list?
Edit:
My list of objects looks like this (countrydata)
place_1:{description:'',image_location:'',location:''}
place_2:{description:'',image_location:'',location:''}
place_3:{description:'',image_location:'',location:''}
My array of objects looks like this (arrayOfObjects)
0: {distance: {…}, duration: {…}, status: "OK"}
1: {distance: {…}, duration: {…}, status: "OK"}
2: {distance: {…}, duration: {…}, status: "OK"}