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

69
Visualizações
Create detail page from forEach using Firestore data

I already have a forEach showing an image and name this is clickable and takes you to a page ../page/details.

Once you click on that page (which would be the same page for all images and names) I want to then load the specific data with that document clicked on from Firestore.

I understand I would need to probably create an identifier and then show that in the detail page so it knows what was clicked (im able to do this in swift), but as models aren't used in JS how do I allow it to understand which content it should show.

As all images and names would be going to the same detail page would their also be a way to add the random doc id to the url so it would look something like ../page/details/Djf73Dhr7W8sJie6c3H9

Code to fetch the forEach and clickable detail page

 const i = query(collection(db, "teams"));
        const unsubscribe = onSnapshot(i, (querySnapshot) => {
            const teams = document.querySelector('.teams');

            querySnapshot.forEach((doc) => {
                const docData = doc.data();
                const team = teams.appendChild(document.createElement('teams'));

                team.innerHTML = `
                <a href="../page/detail.html">
                    <h1 class="team-names"></h1>
                </a>    
                <div class="team-line"></div>
                <img class="team-image">
                `;
                team.children[0].textContent = docData.ageGroup;
                team.children[2].src = docData.teamImage;

                console.log("Current data: ", docData);
            });
        });

Where I show the forEach

<div class="teams">
    </div>
about 4 years ago · Juan Pablo Isaza
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