0

I am completely shocked here. I can see the values right inside the console but I can't seem to access it on the webpage. If I try to display it, I will get an error instantly. Here is the error

TypeError: Cannot read properties of undefined (reading 'profilePicture')

If I console.log like this in my react.js:

   {console.log(singleComment.author.profilePicture)}

I will see the image jpg links. See the attached file. enter image description here

When I console.log like this:

console.log(singleComment.author)

I will see them like this:

enter image description here

You can see the objects there. I can access them all and display on the webpage, including

singleComment.author.username
singleComment.author.email

It is only

singleComment.author.profilePicture

that throws error if I want to display it on the webpage. What Am I missing?

Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129
kinhs
  • 175
  • 13

0 Answers0