What is the problem?
Next.js 报 Hydration failed / Text content does not match,是服务端和客户端渲染结果对不上。常见于 Date/Math.random、typeof window、localStorage、非法 HTML 嵌套、浏览器扩展——逐条给真实成因和修复。
Quick solution
Treat this as a Upwork troubleshooting issue. First confirm the environment, inputs, permissions, logs, and delivery boundary. Then use the linked deep guide for the full checklist before changing production code or promising a result.
Read the deep guideDetailed steps
- 别用 `suppressHydrationWarning` 或随手 `ssr: false` 把所有警告压掉——那是盖住问题,可能影响 SEO(内容首屏不渲染)。
- 改渲染逻辑前先有 Git 记录,方便对比前后行为。
- [报错解释器](/tools/error-explainer)
- [Codex 工具页](/tools/codex)
- [项目报价助手](/tools/pricing-calculator)
- [npm run dev 能跑但 build 失败](/blog/dev-works-build-fails)
Commands or code
const [time, setTime] = useState(null);
useEffect(() => { setTime(new Date().toLocaleString()); }, []);
return <span>{time ?? ""}</span>; // 首屏服务端渲染空,客户端再填Risk notes
Confirm the real project environment, account permissions, platform rules, and output quality before delivery. Do not ship AI-generated changes without human review, and do not claim indexing, income, deployment success, or ranking improvements without measured evidence.