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.

Dynamic routing: Introduction

Dynamic routing: Introduction

Hello and welcome back, welcome to lesson number 4. In this lesson, we are going to discuss dynamic routing and the use of the use-per-arm hook. So, let's start off with what dynamic routing is. Let's start off with what dynamic routing is. It allows us to have flexible routes which can match variety of URLs based on a common pattern. So let's discuss this with an example instead. Consider that you have an array of products. Let me define that at the top. Please be noted that this code is just for understanding purpose and does not have anything to do with logic or react related stuff. So consider that you have a product. I'm going to pick and choose this. The product ID 1 has product A and it has some price and ID 2 has product B. It also has some price and so on. If you would like to have a product view screen and you want to have a route in your application to do that. So I can do something like this, route path is products and I can do products one and I can say the element is…

Contents