You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/hooks/useParams.md
+81-5Lines changed: 81 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,21 +13,97 @@ title: useParams
13
13
Returns an object of key/value pairs of the dynamic params from the current URL that were matched by the routes. Child routes inherit all params from their parent routes.
14
14
15
15
```tsx
16
-
import { useParams } from"react-router"
16
+
import { useParams } from"react-router";
17
17
18
18
function SomeComponent() {
19
-
let params =useParams()
20
-
params.postId
19
+
let params =useParams();
20
+
params.postId;
21
21
}
22
22
```
23
23
24
24
Assuming a route pattern like `/posts/:postId` is matched by `/posts/123` then `params.postId` will be `"123"`.
0 commit comments