Returns URL search parameters as a read-only URLSearchParams object. This provides the standard web API for working with query strings.
The returned object supports all standard URLSearchParams read methods:
Use getAll() when a parameter appears multiple times:
By default, useSearchParams only updates when the current route is focused. Pass { global: true } to update on any route change:
global option cannot change between renders.The returned URLSearchParams is read-only. Calling set(), append(), or delete() will throw an error:
To update search params, use the router:
| Hook | Returns | Use for |
|---|---|---|
useParams | Plain object | Quick access to params as object |
useSearchParams | URLSearchParams | Standard web API, repeated params |
Both hooks include path params and query params. Choose based on which API you prefer:
Edit this page on GitHub.