From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Use Link component to navigate between pages
From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase
Use Link component to navigate between pages
- [Instructor] Next, we create a navigation component to allow user interaction, then allow navigation between views. In this example, we want to create first, a navigation component, then display the user stock images, and finally, we want to create another page to display one single card with one stock image. So first, I'm going to import right here in this nav bar, file, I'm going to import from react-router-dom, the link component. And here, the goal is to create a navigation. So I'm going to replace all the anchor tag, like so. So now we have a new navigation component. And I must also specify where I want to navigate with this link. And this will be similar to the root url. So as we have specified, defined right here, in order to display the corresponding component, which is the root component. So let's do the same to display another root. I mean another link in this navigation. So the purpose is to give the user…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Install React router DOM v62m 53s
-
(Locked)
Configure the routes and create a navigation component2m 51s
-
(Locked)
Use Link component to navigate between pages4m 58s
-
(Locked)
Allow navigation between multiple views5m 39s
-
(Locked)
Conditional rendering and protected route4m 45s
-
(Locked)
Use the React router hooks: useNavigate4m 58s
-
(Locked)
Use the React router hooks: useLocation4m 35s
-
(Locked)
Create the routes for "NotFound" and "Profile"5m 15s
-
(Locked)
Display the active link3m 42s
-
(Locked)
-
-
-