Problem Statement
What are dynamic routes in React Router?
Explanation
Dynamic routes let you match variable segments in URLs, such as user IDs or product IDs. They are defined using a colon prefix like ':id', and React Router provides these values via the useParams() hook.
Code Solution
SolutionRead Only
<Route path='/user/:id' element={<UserProfile />} />;
const { id } = useParams();Practice Sets
This question appears in the following practice sets: