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

152
Vistas
how to get the specific key data from multidimensional array in react?

I am working with an API where I got data in this format:-

[
  0:{
    id: "1"
    name: "ttp"
    platforms:{
       one: "false",
    }
  },

 1:{
    id: "2"
    name: "spt"
    platforms:{
       one: "true",
       two: "true",
    }
  },
},
]

The data is very large it has more than 100 indexes. I want to check if platforms are present in the index. Suppose if any index contains platform one I want to show its id and don't want to show that index that doesn't have platform one. But I am how to do this in React.

Here the code I want to change, Don't want to use the index [0]

if (response.status === 200) {
    console.log(response.data)
    list = response.data[0].platforms;
 }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use filter() to filter your array and get just the elements you need based on a condition.

In your case :

if (response.status === 200) {
    console.log(response.data)
    list = response.data;
    const filteredList = list.filter( (e: any) => (e.platforms.one));
    // filteredList contains just the objects that contains the value one
}
about 4 years ago · Juan Pablo Isaza 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