Navigation Component
The Navigation component will be responsible for the navigation section that all pages in the app will share.
Step 1
Create a Nav.js file in the components
folder.
Step 2
Add code to the Nav.js file so that it looks like this:
In the Nav component, you must have observed that a css
file was imported. It's to give the navbar some custom styling effects. Furthermore, the Bootstrap <nav>
element is used to give the app a basic and functional navbar.
The isLoggedIn()
function is from the AuthService
. It basically checks the user's authentication status. If the user is logged in, the Log out
button is displayed. Otherwise, the Log In
button is displayed to the user.
In order to see this components work visually, you need to set up routes to render them in the browser.
Last updated