From the course: Building React and Django Apps
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Navigating between React components using React Router
From the course: Building React and Django Apps
Navigating between React components using React Router
- React Router turns react into web application framework rather than a component library by providing a browser router, routes, and navigation links, as we can see in line two. With these tools, you can turn a component into a page that is routed to. To use React Router with our app, we need to wrap the whole app component in the browser router. We can see that on line 97, in the render method. As you can see, online 101, we are already linking to the home component using NavLink. We're going to define additional routes that will display specific page components around line 112. Whenever the route exactly matches the slash we'll display the list component. Whenever the URL matches details with an ID, we will render the details component. Additionally, we will be rendering a checkout page with the checkout component. Now, when we display the list of items, we want each item to link to the details page. We're going to…
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.