import {NextIntlClientProvider} from 'next-intl';
import {getLocale, getMessages} from 'next-intl/server';
import { AppProvider } from "@/context/AppContext";
import { Tajawal } from "next/font/google";
const ubuntu = Tajawal({
subsets: ["arabic"],
weight: ["300", "400", "500", "700"],
});
export default async function RootLayout({ children }) {
const locale = await getLocale();
const messages = await getMessages();
const direction = locale === "ar" ? "rtl" : "ltr";
return (
<htmllang={locale}dir={direction}><bodyclassName={ubuntu.className}><NextIntlClientProvidermessages={messages}><AppProvider>
{children}
</AppProvider></NextIntlClientProvider></body></html>
);
}
تسبب في هذا الخطأ
Console Error
Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used
- A server/client branch `if (typeof window !== 'undefined')`.
- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
- Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.
It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
See more info here: https://nextjs.org/docs/messages/react-hydration-error
- lang="en"
- dir="ltr"
- className="__className_f09b3f"
Call Stack
Next.js
السؤال
محمود سعداوي2
السلام عليكم.
الكود التالي
تسبب في هذا الخطأ
Console Error Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used - A server/client branch `if (typeof window !== 'undefined')`. - Variable input such as `Date.now()` or `Math.random()` which changes each time it's called. - Date formatting in a user's locale which doesn't match the server. - External changing data without sending a snapshot of it along with the HTML. - Invalid HTML tag nesting. It can also happen if the client has a browser extension installed which messes with the HTML before React loaded. See more info here: https://nextjs.org/docs/messages/react-hydration-error - lang="en" - dir="ltr" - className="__className_f09b3f" Call Stack Next.js
شكرا لكم
4 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.