I am getting an array with objects from mongodb with react.js and create a ranking list with map, sorted by rating.
{album && album.map && album.map((d) =><Link className="link" to={{ pathname: "/itemPage/" + d.id, album: d}}>{d.isSingle? <ul className={"listNumber"}> <span className={"info"}>{i++}. {d.artist} - {d.title}<b className={"rating"}>{getRating(d)}</b></span> </ul> : ""}</Link>)}
it works wonderfully and my list looks like this with 4 objects.
Now I would like to include the condition, that the first 3 rankings should include a img. I save the img for each object, so it is easily accessible with
<img src={d.imgSmall}/>
the object looks like this.
artist: "Eminem"
id: "61a9474968f7d778e3ee73f4"
imgSmall: "https://i.scdn.co/image/ab67616d00001e0255f592593d746c4fd1fa5ae9"
isSingle: true
rating: 8.5
reviews: (2) [{…}, {…}]
title: "xxx"
My Problem is I can only make it work to have every entry include the img.