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

231
Vistas
React mapping ERROR: Cannot read properties of undefined (reading 'toLocaleString')

Im trying to map the list of my expense array elements and after using the map() method Im getting the error "Uncaught TypeError: Cannot read properties of undefined (reading 'toLocaleString')". I couldn't find the issue please check the code link - https://github.com/mohitdevelops/react-lessons/tree/main/toLocalString-issue

Please help me out, I'm stuck in this error for days.

And checkout the screenshot here 👇

enter image description here

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

0

You're using the wrong object keys in your expenseData object in the ExpenseForm component. And so the date will "always" be undefined thus failed during the date conversion in your ExpenseDate component. To fix this, you just need to supply the correct object:

From this:

const expenseData = {
    inputValue: enteredValue,
    inputAmount: enteredAmount,
    inputDate: new Date(enteredDate),
};

To this:

const expenseData = {
    id: "e5", // You will need to figure out a way to create a dynamic ID here :)
    title: enteredValue,
    amount: enteredAmount,
    date: new Date(enteredDate),
};
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