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

109
Views
Filtering the array with objects but it doesn't filter the array

Below is my State in Reactjs Functional Component

let valueByFilterInitState = [{ filterType: "Organization", value: "Micro", id: "15" }, { filterType: "Vehicle", value: "Bmw", id: "13" }]
const [filterListValue, setFilterListValue] = useState(valueByFilterInitState)

Here I am trying to filter the the list but it doesn't filter & returning the same array

const chipHandler = (list) => {

        setFilterListValue(filterListValue => {
            const copy = [...filterListValue]
            let test = copy.filter((val) => {

                if (val.value === list.value) {

                    return { filterType: val.filterType, value: "", id: "" }
                }
                return val
            })

            return test
        })
    }

Here I am rendering those filterListValue

<div style={{ display: "flex", justifyContent: "start", alignItems: "start", columnGap: 4 }}>
                        {
                            filterListValue.filter((selectedFilter) => selectedFilter.id !== "").map((list, index) => {
                                return (<Chip variant="outlined" label={list.value} onDelete={() => chipHandler(list, index)} />)
                            })
                        }
                    </div>
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!