Inside server components (like app/[id]/page.jsx), use route params and searchParams from the function argument:
export default function Page({ params, searchParams }) {
return (
<>
<h1>ID: {params.id}</h1>
<p>Name: {searchParams.name}</p>
</>
);
}For client components, use usePathname() and useSearchParams() from next/navigation.