Handling route parameters
The URLs that you've seen so far in this chapter have all been static. Most applications will use both static and dynamic routes. In this section, you'll learn how to pass dynamic URL segments to your components, how to make these segments optional, and how to get query string parameters.
Resource IDs in routes
One common use case is to make the ID of a resource part of the URL. This makes it easy for your code to get the ID and then make an API call that fetches the relevant resource data. Let's implement a route that renders a user detail page. This will require a route that includes the user ID, which then needs to somehow be passed to the component so that it can fetch the user.
Let's start with the App
component that declares the routes:
import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; import UsersContainer from "./UsersContainer"; import UserContainer from "...