[{
"NS": "food",
"Brand": "bosch",
"legendKey": "5_1"
},
{
"NS": "food",
"Brand": "bosch",
"legendKey": "5_1"
},
{
"NS": "performance",
"Brand": "ge",
"legendKey": "4_2"
}]
<ul class="legend">Needstates
{
this.state.legend ? legend.map((ele, i) =>{
return(
<li>
<span key={i} style={{backgroundColor:this.state.colors[ele['legendKey'][2]-1]}}></span> {ele['NS']}
</li>
)
}
):
null
}
</ul>
Here i am trying to map above json in react.js. But some of them are duplicates As per NS key.
How can i map after removing duplicates.
PLease have a look