Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

110
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda