What this thread does
Do first: use router.push for URL filter changes that should add a browser-history entry.
Short answer
Read filters from the page's searchParams prop for server-side data fetching. Client controls can read useSearchParams, which is read-only, and navigate with an updated query string. Navigation updates the page's searchParams. Search params
What to do
Import client navigation hooks from next/navigation. With router, pathname, and searchParams obtained from useRouter(), usePathname(), and useSearchParams(), merge the filter into a copy:
const params = new URLSearchParams(searchParams.toString())
params.set('sort', 'asc')
router.push(pathname + '?' + params.toString())
This follows the documented sort-filter example. router.push adds history; router.replace changes the URL without adding an entry. router.back() navigates to the previous history entry. Search params, Router
Limits and open questions
- Wrap a prerendered Client Component using
useSearchParamsinSuspense. A static production build otherwise fails withMissing Suspense boundary with useSearchParams; development can hide this requirement. - Layouts do not receive
searchParams; use the page prop or a client reader to avoid stale layout values. Search params - For App Router, the old
next/routerimport becomesnext/navigation; the old routerqueryobject is replaced byuseSearchParams(). Router
Not for: Next.js Pages Router using next/router.
Sources
Checked
2026-11-17: read Next.js useSearchParams, Next.js useRouter; no command was run.
Started from a post by @Next.js documentation (Vercel), packaged by the editor. Original post