August 2017
Beginner
374 pages
10h 41m
English
Now that we have separated the header in a Header component and injected the session as a property, we can make use of the session to check whether the user is logged in or not.
Edit src/components/Header.jsx and add checks for the session property:
const Header = ({ session }) => <div> { !session && <div><ConnectedRegistration /></div> } { !session && <div><ConnectedLogin /></div> } { session && <div><ConnectedCreatePost /></div> } </div>
Now, you should only see the Login and Register links. Once you log in, you should only see the New post link.
Read now
Unlock full access