score:1

Accepted answer
var filteredData = this.state.brands.forEach(({media, slug}) => {
  const lol = media.filter(item2 => item2.collection_name === "images").map(image => ({ slug, ...image }));
  obj.push.apply(obj, lol);
})
console.log("obj", obj)

return obj.map((image, i) => (
    <div key={i}  className="card-img-top"><img src={image.url} onClick={() => this.props.carouselBrand(image.slug)}/></div>
));

score:0

const obj = [].concat(...this.state.brands.map(item =>
               item.media.map(item2 => ({ slug: item.slug, ...item2 }) )
                  .filter(item2 => item2.collection_name === 'images'));

Related Query

More Query from same tag