我正在使用 Next.js 制作一个网站,每次都会显示上述错误。
不知道我的代码有什么问题。
显示错误: 错误:水合失败,因为初始 UI 与服务器上呈现的内容不匹配。警告:预期服务器 HTML 包含 .在此处查看更多信息:https://nextjs.org/docs/messages/react-Hydration-error
错误:补水时出现错误。
` “使用客户端”;
从“lucide-react”导入{菜单};
从“@/components/ui/button”导入{Button}; 进口 { 床单, 工作表内容, 工作表触发器 来自“@/components/ui/sheet” 从“@/components/sidebar”导入侧边栏;
const MobileSidebar =() => { 返回 ( ); }
导出默认的MobileSidebar; `
代码应该实际工作并且不应显示任何错误。 非常感谢那些愿意提供帮助的人!
“使用客户端”;
从“lucide-react”导入{菜单};
从“@/components/ui/button”导入{Button}; 进口 { 床单, 工作表内容, 工作表触发器 来自“@/components/ui/sheet” 从“@/components/sidebar”导入侧边栏;
const MobileSidebar =() => { 返回 ( ); }
导出默认MobileSidebar;