I'm displaying data on a grid using a nested map which looks like
{
this.state.rows.map((qc) =>
qc.BinsByDayByOrchardsQCs.map((qc2) =>
qc2.BinsByDayByOrchardsQCsDefects.map((qc3) =>
{console.log("results", qc3.Defect)}
<div className="row table">
{qc3.Defect}
</div>
)
)
)
}
Which returns data that looks like this
results Scuff
results Sunburn
results Bruise
results Hail damage
results Scuff
results Sunburn
results Bruise
results Scuff
results Sunburn
results Hail damage
How to get rid of the duplicates? I have tried
{console.log("unique",[...new Set(qc2.BinsByDayByOrchardsQCsDefects.map((qc3) => qc3.Defect))])}
but that returns each iteration of the mapped object
this.state.rows