useParams is a Client Component hook that lets you read a route’s dynamic parameters as filled in by the current URL.
app/example-client-component.tsx
Parameters
useParams takes no parameters.
Returns
An object containing the current route’s filled-in dynamic segments.- Each key is a dynamic segment name.
- Each value is a
string(for[param]) orstring[](for[...param]). - Returns an empty object
{}if the route has no dynamic segments. - Returns
nullwhen used in the Pages Router before the router is ready.
Example
app/product/[id]/edit/page.tsx
