#current search params in page.tsx

1 messages · Page 1 of 1 (latest)

tall sierraBOT
#

Hi @mossy kestrel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To access search params in a Next.js page, you can use the searchParams prop. Here's an example of how to do this in a page.tsx file:

export default function Page({
  params,
  searchParams,
}: {
  params: { slug: string };
  searchParams: { [key: string]: string | string[] | undefined };
}) {
  return <h1>My Page</h1>;
}

In this example, searchParams is an object containing the query string parameters from the URL. You can access the values using the keys of the searchParams object.

Source: Next.js Documentation (https://nextjs.org/docs/app/api-reference/file-conventions/page)

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: