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

230
Views
How do I put my firestore data into a table?
export function ListData() {
  const [dataList,setDataList] = useState([]);
  useEffect(() =>{
      async function callData(){
         const result = await GetAllDataOnce()
         return result
      }
     setDataList(callData())
   },[])
  async function GetAllDataOnce() {
     const querySnapshot = await getDocs(collection(db, "repos"));
     var data = [];
     querySnapshot.forEach(doc => {
        data.push({
          id: doc.id,
          data: doc.data()
        })
     })
    return data;
  }
 return (
      <table>
        {dataList.map(returndata => (
          <tr key={returndata.id}>
            <td>{returndata.data}</td>
          </tr>
        ))}
      </table>
)}

Here is the data I am working with: image This is using react with firebase firestore. I want to display each name with their respective desc, icon, and repo. I am getting error

table.js:37 Uncaught TypeError: dataList.map is not a function

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think you could try to debug by printing value from the function callData, then check if it is an array.

async function callData(){
   const result = await GetAllDataOnce()
console.log(result) 
console.log(typeof result)
    return result
}
about 4 years ago · Juan Pablo Isaza Report
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!