#How do I access url params in an RSC?
1 messages · Page 1 of 1 (latest)
In Next.js, to access query parameters in a Server Component, you can use the searchParams prop. This prop is available in the page.js component and in the generateMetadata function. When client navigations update search parameters, a new request is sent to the server, causing a re-render.
Here is the relevant documentation for the searchParams prop: Next.js Documentation (https://nextjs.org/docs/app/api-reference/file-conventions/page#searchparams-optional)
Please note that if you are using Client Components, you can use the useSearchParams hook to access the current query parameters. Here is the relevant documentation for the useSearchParams hook: Next.js Documentation (https://nextjs.org/docs/app/api-reference/functions/use-search-params)