I have an object Array list and this array list includes duplicate values. So I need to render only unique values. But it's not working.
{promotions.map((row) => (
<div>
<h1>{row.name}</h1> //This is working
{row.products.map(() => {
const pp = row.products.filter( (ele, ind) => ind === row.products.findIndex( elem => elem.productId === ele.productId))
pp.map((data)=>{
return(
<Chip
key={`${row.productId}_${data.productId}`}
classes={{ root: classes.productsChipRoot }}
label={data.productName}
style={{ margin: 3, backgroundColor: '#BBD7FB' }}
/>
)
})
})}
</div>
))}
pp.map. E.g.:return pp.map(...And potentially also flatten the result of your first map call. E.g.row.products.map(...).flat()