Next.js Discord

Discord Forum

need help how can i get searchParams in layout

Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Open in Discord
Avatar
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>;
}

4 Replies

Avatar
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
Avatar
joulev & fuma pray for Schneider