Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user={undefined} to UserProfile.js #19

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

andriusmv
Copy link

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>
  );
}

@vercel
Copy link

vercel bot commented Apr 26, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
next-firebase-course ✅ Ready (Inspect) Visit Preview Apr 26, 2022 at 4:43PM (UTC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants