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' }];
|
||||
}
|
||||
|
||||
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
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user