Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
JS comparison two arrays (Tag filter)

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!