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

162
Views
firebase data with next.js. How to get data to display?

I am learning firebase with next.js. I would like to bring data from firebase to display. I am connected to firebase, but my output is not working. Can you please tell me whot I am doing wrong? Thank you

folder libs:

export async function Ids() {
  let output = []

  try {
    const data = await firebase.collection('database').get()

    data.forEach(doc => {
      output.push({
        params: {
          id: doc.id,
          ...doc.data()
        }
      })
    })
  } catch (err) {
    console.log(err)
  }
  
  return output;
}

folder pages / index.js

import { Ids } from '../lib/resources'


export async function getStaticProps() {
  const itemData = await Ids()
  return {
    props: { itemData }
  }
} 


export default function Home( {itemData} ) {
  return (
    <>
     <h2 className="text-center mt-5">Data</h2>  // it show me only this h2 statement
     
     
     {
        itemData ? 
        itemData.map( (doc) => {
          <p className="text-center" key={doc.id}>{doc.title}</p>
        }) : null 
     }
   </>
  )
}

almost 4 years ago · Santiago Trujillo
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!