need some help in reactjs
i have this data below and i want to display it wihout duplicate, meaning, it should be a single category for "A", "B" and "D", i want to do this inside the map below.
const person = {
con: [
{ category: "A", name: "john" },
{ category: "A", name: "john" },
{ category: "B", name: "rahul" },
{ category: "B", name: "jay" },
{ category: "C", name: "dave" },
{ category: "D", name: "alex" },
{ category: "D", name: "alex" },
{ category: "E", name: "sam1" },
{ category: "F", name: "sam2" },
{ category: "G", name: "sam3" },
]
};
person.con && person.con.map((data, index) => (
console.log(data, 'data')
// I want to display results here...
))
expected output:
{ category: "A", name: "john" },
{ category: "B", name: "rahul" },
{ category: "C", name: "dave" },
{ category: "D", name: "alex" },
{ category: "E", name: "sam1" },
{ category: "F", name: "sam2" },
{ category: "G", name: "sam3" },
is this possible? Thank you.