#current search params in page.tsx
1 messages · Page 1 of 1 (latest)
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.