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

182
Views
studentslearn.map() is not a function

I tried mapping data with react from an array nested in a firestore collection but I get an error:

array.map() is not a function.

This is how I tried tried mapping from the the collection, where courseinfo is the state storing returned data from firebase

{courseinfo.students_learn.map((students)=>{
                        return(<CourseLearnItem>{students}</CourseLearnItem>)
                    })}

This is the structure of the collection I'm trying to get data from the students_learn field

enter image description here

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

0

I believe that you should parse the courseinfo.students_learn first because from what I saw it is a string.

const studentList = JSON.parse(courseinfo.students_learn);
return (
  <div>
    {studentList.map((student) => (
        <CourseLearnItem>{student}</CourseLearnItem>
    ))}
  <div/>
);

about 4 years ago · Juan Pablo Isaza Report

0

Based on your screenshot, students_learn is a string and map is a function for arrays.Since you are trying to apply array function to String it throws an error.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

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!