Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

317
Visualizações
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 Respostas
Responde à pergunta

0

Just use this inside the setFilteredProducts for filtering

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

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda