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

181
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
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