So I have data like the following:
[
{
\"id\": 0,
\"title\": \"happy dayys\",
\"owner\": {\"id\": \"1\", \"username\": \"dillonraphael
You don't want a filter
inside a filter
- rather, inside the filter, check if some
of the tags
objects have the .value
property that you want
const _moodboards = [
{
"id": 0,
"title": "happy dayys",
"owner": {"id": "1", "username": "dillonraphael"},
"tags": [{"value": "Art", "label": "Art"}],
"items": []
},
{
"id": 1,
"title": "happy dayys",
"owner": {"id": "1", "username": "dillonraphael"},
"tags": [{"value": "Architecture", "label": "Architecture"}],
"items": []
},
];
const name = 'Architecture';
console.log(_moodboards.filter(({ tags }) => (
tags.some(({ value }) => value === name)
)));