I have to access data from an API that is similar to:
{
"speakers": [
{
"name": "speakerName",
"profile_picture": "profilePic"
}
]
},
{
"speakers": []
}
I saved speakers as an array, but I am not sure how to access the objects inside the inner array. The speakers parameter gives the entire array (name and profile picture).
const PublicEventsInfo = ({speakers}) => {
}
When I try the code below, I get the error: TypeError: Cannot read properties of undefined.
speakers[0].name
How would I access just the name portion of speakers inside PublicEventsInfo?