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 parameterized routes - React.js Tutorial
From the course: React Foundations by Pearson
Defining parameterized routes
Right, well, now we're going to look at parameterized routes. You can define a parameterized route that looks like this. This part here is a placeholder for an actual ID. When the user navigates to a route like this, slash product slash one, for example, React will pattern match the route that we've navigated to against the route table. And it will notice that this bit corresponds to that section. And basically what it means is I want to display the product whose ID is one. Right, so our demo application has parameterized routes. If you click on the products link, then it basically gets all the products. And for each product, it'll generate a hyperlink. And these hyperlinks are like this, product one, product two, product three. So in each case, it'll take you to the product component and it'll pass either one or two or three as a parameter for the ID. Depending which link you click on, you're passing a different value for the ID. Okay, so in our demo application, we actually have two…
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)
-
-