fix: nextjs 15+ async params for layout and page
This commit is contained in:
@@ -22,15 +22,17 @@ export async function generateStaticParams() {
|
|||||||
return [{ lang: 'tr' }, { lang: 'en' }];
|
return [{ lang: 'tr' }, { lang: 'en' }];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function RootLayout({
|
export default async function RootLayout({
|
||||||
children,
|
children,
|
||||||
params,
|
params,
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
params: { lang: string };
|
params: Promise<{ lang: string }>;
|
||||||
}>) {
|
}>) {
|
||||||
|
const { lang } = await params;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang={params.lang} className="scroll-smooth">
|
<html lang={lang} className="scroll-smooth">
|
||||||
<body className={`${lato.variable} ${playfair.variable} antialiased`}>
|
<body className={`${lato.variable} ${playfair.variable} antialiased`}>
|
||||||
{children}
|
{children}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+2
-1
@@ -8,7 +8,8 @@ import Contact from "@/components/Contact";
|
|||||||
import Footer from "@/components/Footer";
|
import Footer from "@/components/Footer";
|
||||||
import { getDictionary } from "../dictionaries";
|
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);
|
const dict = await getDictionary(lang);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user