KELEN / blog-comment

0 stars 0 forks source link

NextJs报错,Warning: Extra attributes from the server: xxx #157

Open KELEN opened 4 months ago

KELEN commented 4 months ago

https://www.kelen.cc/posts/65dd852769df79c10e121e50?admin=true

Nextjs浏览器控制台警告:Warning: Extra attributes from the server: mpa-version,mpa-extension-id,今天启动项目时,发现控制台突然多了个警告。

xiaodeng262 commented 2 months ago

layout下面的添加 suppressHydrationWarning={true}

{children}
ifer47 commented 1 week ago

src/app/layout.tsx,html 标签添加 suppressHydrationWarning={true},如下:

import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" suppressHydrationWarning={true}>
      <body className={inter.className}>{children}</body>
    </html>
  );
}