I have this data
[
{
"filePath": "imageFile",
"locationName": "name1"
},
{
"filePath": "imageFile",
"locationName": "name2"
}
]
and I am returning the value of filePath to display images using React js in a card like this:
const images = (displayimage) => {
return displayImages.map((displayimage, key) => (
<div key={key}>
<div className="card bg-light mb-3">
<div className="card-header">
<center>{displayimage.locationName}</center>
</div>
<div className="card-body">
<div className="imgDiv">
<img src={displayimage.filePath} />
</div>
</div>
</div>
</div>
));
}
return <div>{images()}</div>;
};
but only 1 card is returning then the image is returning randomly based on which object is displayed 1st in the console.log(displayImages).
how can I display all each cards per images? Thanks