next.js
304940e9 - docs: add useSearchParams and useParams documentation for Pages Router (#88429)

Commit
66 days ago
docs: add useSearchParams and useParams documentation for Pages Router (#88429) ## Description This PR adds dedicated documentation pages for `useSearchParams` and `useParams` hooks in the Pages Router documentation. ### Changes - Added `docs/02-pages/04-api-reference/03-functions/use-search-params.mdx` - Added `docs/02-pages/04-api-reference/03-functions/use-params.mdx` ### Why Both `useSearchParams` and `useParams` from `next/navigation` work in the Pages Router, but this was not well documented. The only mention was a brief note in the App Router docs and a migration section in the Pages Router `useRouter` docs. ### What's Documented For both hooks: - Basic usage with the fallback UI pattern for handling `null` during pre-rendering - Return values and behavior differences from App Router - Usage with `getServerSideProps` (where params are immediately available) - Examples for sharing components between App Router and Pages Router For `useParams` specifically: - Comparison with `router.query` (which includes both dynamic params and query string params) ### Related Test The existing test at `test/e2e/app-dir/params-hooks-compat` validates that these hooks work in both routers.
Author
Parents
Loading