我正在使用 NextJS 15 和 Chakra UI 开始创建一个简单的表单,但是我在控制台中收到错误:
但是路径的内容可以显示,但我不明白问题是什么,因为我是下一步的新手。我一步一步跟着ChakraUI安装。
我使用的代码是这样的:
import { Box } from "@chakra-ui/react";
export default function RegisterPage() {
return (
<Box>
<h1>Register</h1>
</Box>
);
}
您需要添加
suppressHydrationWarning
,就像步骤 3 中的脉轮文档中一样:
import { Provider } from "@/components/ui/provider"
export default function RootLayout(props: { children: React.ReactNode }) {
const { children } = props
return (
<html suppressHydrationWarning>
<body>
<Provider>{children}</Provider>
</body>
</html>
)
}