Skip to content
Advertisement

Getting the error: “data.id is undefined” while iterating a JSON array

Trying to log the data in the array but getting an error: data.id is undefined

JavaScript

This is the JSON array which is being mapped:

JavaScript

Advertisement

Answer

You are logging the main array instead of the mapped item, try changing to:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement