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

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

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 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