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

319
Vistas
How to filter the products that are only in Stock? (ReactJS)

I am trying to filter the products that are only inStock: true, I do not know how to insert it on this code:

enter image description here

The products are showing even the inStock is false. Here is how my products look like:

enter image description here

about 4 years ago · Santiago Gelvez
2 Respuestas
Responde la pregunta

0

Just use this inside the setFilteredProducts for filtering

products.filter((product)=>product.inStock)
about 4 years ago · Santiago Gelvez Denunciar

0

If you want to filter the items depending on the value of inStock you should use .filter() like so:

products.filter(product => product.inStock === true)

Here product represents an element of products, which in your case is an object, and like any object you can access the properties inside using the dot accessor '.'

about 4 years ago · Santiago Gelvez Denunciar
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