I want to build a self updating filter with checkboxes.
My Data:
const Shooting= [
{
name: "John & Johna ",
tag: ["wedding", "couple"],
img: [ src1 , src2, ...] //irrelevant
},
{
name: "Mario & Marie",
tag: ["couple", "NSFW"],
img: [ src1 , src2, ...] //irrelevant
},
];
export default Shooting;
how my output should look like that:
Filter:
[]wedding
[]couple
[]NSFW
// [] are checkboxes, "couple" is a duplicate in the array
My code idea:
- Get all tags into a new array
- Build function to remove duplicates from new array
- list the filtered array with map-function -> Obj.map((tag))=>{...}
My question:
How can I get all tags in a new list?