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

164
Vistas
Display nth comment only when the nth value of an array is equal to true in react from firebase
<div class="container card">
        <p>{individualProduct.user_comments.map((eachComment) => (
                <h1 className='comment'> {eachComment} </h1>
        ))}</p>
</div>

By doing this I am simply printing each value in the use_comments array, however, my goal is looping through ucomments_is_approved, and once for example ucomments_is_approved[3] == true then i should show user_comments[3], i have linked below a screenshot of my data base to make it easier, i am new to javascript thus i think its very simple however i was not able to figure it out, any help would be good.

i have a given array ucomments_is_approved =[true,false,false,true] and another array comments_users = ["good","bad", "verybad","recommended"], what I have to do is only show the comments_users when ucomments_is_approved is true so I should only show "good" and "recommended" in this case.

FIREBASE DATABASE PICTURE SHOWING THE UCOMMENTS_IS_APPROVED AND USER_COMMENTS

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

<div class="container card">
        <p>{individualProduct.user_comments.map((eachComment, i) => {
              ucomments_is_approved[i] ? (
                 <h1 className='comment'> {eachComment} </h1>
               ): null
                
        })}</p>
</div>
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