From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Recap: Routing with Link

Recap: Routing with Link

Hello and welcome to lesson number 2 In this lesson, we are going to learn about the core components of react-router-library Let's recap what we have learned so far about routing We have to use the route component and we can map it with a url path and a react component to destination The path prop in the route component is for the URL, if the URL matches the path that has been defined over here, then browser is going to redirect you to that URL. The element prop defines the component that needs to be rendered when the path has matches. Now we are going to learn about navigating with link. Just like the route, link is another component for react router library. This is a core component for navigation. It prevents the browser from doing a full page refresh. Let's get back to this example. Over here, you can see that when you were routing with URL, you were actually getting a page refresh. Look at this reload bar. If I am going to route to any other component, then you can see a refresh…

Contents