How to find and remove duplicates in array of object
Posted on November 11, 2023
Here the snippet I found, very fast!
const uniq = (arr, key) => {
return [
... new Map(
arr.map(x => [key(x), x])
).values()
]
}
const data = uniq(incomingData, item => item.id)