You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was my version following the course tutorial...
importLinkfrom'next/link';importReactfrom'react';import{useContext}from"react";import{UserContext}from"../lib/context";// Top NavbarexportdefaultfunctionNavbar(){const{ user, username }=useContext(UserContext)return(<navclassName='navbar'><ul><li><Linkhref="/"><button>FEED</button></Link></li>{/* user is signed in and has username */}{username&&(<div><liclassName='push-left'><Linkhref="/admin"><buttonclassName="btn-blue">Write Posts</button></Link></li><li><Linkhref={`/${username}`}><imgsrc={user?.photoURL}alt=/></Link></li></div>
)}{/* user is not signed in OR has not created username */}{!username&&(<li><Linkhref="/enter"><buttonclassName="btn-blue">Log in</button></Link></li>)}</ul></nav>)}
Neither have worked... I'm using WebStorm
The text was updated successfully, but these errors were encountered:
Not sure if you fixed this yet, but I reproduced your error. The issue is in the second <Link> of your LoggedIn function. The img tag alt attribute has an error. It's currently alt=, so it's pointing to nothing. Change it to something like alt='user' and that should resolve the issue.
I've been unable to get the Navbar component to work once I add the React Context. I get the following error message:
I've tried to refactor the code many ways but still getting a similar message.
This is my latest version:
This was my version following the course tutorial...
Neither have worked... I'm using WebStorm
The text was updated successfully, but these errors were encountered: