Open andriusmv opened 2 years ago
What: add user={undefined} to user (line 2 of file "UserProfile.js") Where: UserProfile.js Why: to avoid TypeError: Cannot read properties of undefined (reading 'photoURL'), (reading 'username') and (reading 'displayName').
Code should look like this:
// UI component for user profile export default function UserProfile({ user={undefined} }) { return ( <div className="box-center"> <img src={user.photoURL || '/hacker.png'} className="card-img-center" /> <p> <i>@{user.username}</i> </p> <h1>{user.displayName || 'Anonymous User'}</h1> </div> ); }
The latest updates on your projects. Learn more about Vercel for Git ↗︎
What: add user={undefined} to user (line 2 of file "UserProfile.js") Where: UserProfile.js Why: to avoid TypeError: Cannot read properties of undefined (reading 'photoURL'), (reading 'username') and (reading 'displayName').
Code should look like this: