need help how can i get searchParams in layout
Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Cuvier’s Dwarf CaimanOP
import { ReactNode } from "react";
export default function Layout({
children,
searchParams,
}: {
children: ReactNode;
searchParams: { [key: string]: string | undefined };
}) {
console.log(searchParams);
return <div className="max-w-3xl mx-auto">{children}</div>;
}
export default function Layout({
children,
searchParams,
}: {
children: ReactNode;
searchParams: { [key: string]: string | undefined };
}) {
console.log(searchParams);
return <div className="max-w-3xl mx-auto">{children}</div>;
}
4 Replies
Cuvier’s Dwarf CaimanOP
i wont to get searchParams in layout.tsx and this file can not be client side render (if ou have any example then show me)
useSearchParam() is client side hook but i need searchParams in layout.tsx file i can not use this hook in layout.tsx file
it's impossible to get searchparams in layout.tsx RSC files https://nextjs.org/docs/app/api-reference/file-conventions/layout#layouts-do-not-receive-searchparams