I want to do tag filter for my project with React. I have models and activeTag.
models:
{
"id": 1,
"name": "Test Model",
...
"user_tags": [
{
"id": 5,
"name": "cemreTest"
}
],
...
},
activeTags:
[1,3]
I need to models which is filtered according to activeTags. I tried like these;
this.state.models.filter(item => item.user_tags.map(t => t.id) == 1).map(...)
This code it works.. But I need to put activeTags array instead of "1"
Like this;
this.state.models.filter(item => item.user_tags.map(t => t.id) == this.state.activeTag.map(at => at.id)).map(...)
How can I solve it ? Shortly, I want to filter multi values like a basic tag filters.