fix: nextjs 15+ async params for layout and page

This commit is contained in:
mstfyldz
2026-06-03 17:35:42 +03:00
parent a952f571b9
commit 121e127f6b
2 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -22,15 +22,17 @@ export async function generateStaticParams() {
return [{ lang: 'tr' }, { lang: 'en' }];
}
export default function RootLayout({
export default async function RootLayout({
children,
params,
}: Readonly<{
children: React.ReactNode;
params: { lang: string };
params: Promise<{ lang: string }>;
}>) {
const { lang } = await params;
return (
<html lang={params.lang} className="scroll-smooth">
<html lang={lang} className="scroll-smooth">
<body className={`${lato.variable} ${playfair.variable} antialiased`}>
{children}
</body>
+2 -1
View File
@@ -8,7 +8,8 @@ import Contact from "@/components/Contact";
import Footer from "@/components/Footer";
import { getDictionary } from "../dictionaries";
export default async function Home({ params: { lang } }: { params: { lang: string } }) {
export default async function Home({ params }: { params: Promise<{ lang: string }> }) {
const { lang } = await params;
const dict = await getDictionary(lang);
return (