Returns URL parameters for the focused route, including dynamic segments and query string values.
This hook only updates when the route using it is focused, making it ideal for stack navigators where pushed screens shouldn’t react to parameter changes in other screens.
createRoute (Recommended)The best way to get fully typed params is with the createRoute helper:
Enable auto-generation in your vite config to have this inserted automatically:
See Typed Routes for full setup details.
You can also type params manually:
For catch-all routes like [...slug].tsx, params are returned as arrays:
Parameters are automatically URL-decoded:
| Hook | Updates when… | Best for |
|---|---|---|
useParams | Route is focused | Most components |
useActiveParams | Any route changes | Analytics, global UI |
In a stack navigator, if you push a new screen, useParams in the previous screen won’t update. Use useActiveParams if you need global parameter updates.
Edit this page on GitHub.