Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

60
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!