basir / amazona

Build Ecommerce Like Amazon By MERN Stack
https://www.udemy.com/course/build-ecommerce-website-like-amazon-react-node-mongodb
595 stars 482 forks source link

Cannot read 'name' property of undefined #71

Open mHuzefa opened 3 years ago

mHuzefa commented 3 years ago

At line 23 of Product.js in components folder, You have this error "{product.seller.seller.name}". seller is being called twice.

noelsr0102 commented 3 years ago

what will I do to resolve this I'm a new developer

noelsr0102 commented 3 years ago

image

noelsr0102 commented 3 years ago

Already resolved seen your File Change

Royal6969 commented 3 years ago

Friends, that issue it is very easy to resolv !! As Basir said in that video, the second seller is accessing to the seller fields in the user ProfileScreen, and this user is a seller! but in ProfileScreen you have to write a name for this seller I think your're getting that issue becasuse you forgot fill that field... So first, try to write a name for each seller that you've got... Then, you have to go to MongoDB and the ID of each seller, has to be the same id for his group of products, saying by other way, change your ID products for the ID of one seller for all those products that he has. Visit my comment in the github code for that video (creating seller page)