From the course: React Foundations by Pearson
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Defining nested routes - React.js Tutorial
From the course: React Foundations by Pearson
Defining nested routes
React Router lets you define nested routes. This is what it looks like. You define a component which has a nested route table underneath it. So in this example here, I've got, if you like, a top-level route, products with nested routes, and when the user gets there, it'll render this component. I'll draw that here. Okay, so products with nested roots, that's this component here. The key point is, well, this component can render some stuff, but the key point is it has an outlet element. And that outlet element is like nested content, and the children property here specifies what to display inside the outlet. Depending on exactly which route you specify, different sub-components get displayed inside the outlet. So either this, or this, or this will be displayed inside the outlet element, nested inside the big component. So that's the mechanism. We need to describe how that actually works in detail. So, from the top, when the user navigates to this path, this component will be rendered…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Learning objectives58s
-
(Locked)
Recap of routing5m 38s
-
(Locked)
Introducing an application that illustrates additional routing techniques12m
-
(Locked)
Defining parameterized routes11m 16s
-
(Locked)
Navigating to a route programmatically8m 36s
-
(Locked)
Defining nested routes10m 37s
-
(Locked)
Loading data for a route11m 3s
-
(Locked)
Lab: Routing techniques17m 25s
-
(Locked)
Lab solution: Routing techniques5m 19s
-
(Locked)
-
-