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

176
Vistas
React callback return not iterable instance

I'm using ant-desing(v3.26.14) List component in React. Normally if I try to pass plain array to 'dataSource' property then everything is fine. But when I try to pass array via callback it's given error.

<List dataSource={someArray} /> //is fine
<List dataSource={() => someArray} /> //getting error

Error: 'TypeError: Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.'

I wonder is this normal behaviour of javascript or some library issue and why that's happening, isn't this the same thing?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think it's because the List component is expecting the array so it can use the spread, but you are giving it a callback function. It doesn't expect a callback function but an iterator ( array in this case ).

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