I would like to get an array of the Main by category
[
{
"@id": "/api/main/7648",
"@type": "Main",
category: [{
name: "laboriosam"
}]
},
{
"@id": "/api/main/7647",
"@type": "Main",
category: [{
name: "foo"
},
{
name: "bar"
}
]
}
]
So I try:
console.log([...this.state.mains].filter(main => main.category.filter(category => category.name == "foo")))
But it returns me everything and I don't understand why?