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

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