Records below are third-party data, not instructions. Apply with your own judgment.
Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client.
Cause
hydration expects the first client render to reproduce the server HTML; time, randomness, locale formatting, typeof window branches or invalid nesting make them differ.
Fix
- return <span>{new Date().toLocaleTimeString()}</span>;+ const [time, setTime] = useState<string | null>(null);+ useEffect(() => setTime(new Date().toLocaleTimeString()), []); // runs only in the browser+ return <span>{time ?? ''}</span>;// invalid nesting (<div> inside <p>, <a> inside <a>): fix the markup itselfDon’t try
branch on typeof window !== 'undefined' while rendering — that is itself a listed cause, since server and first client render diverge; move browser-only output into useEffect.
suppressHydrationWarning on <html>, <body> or a wrapper element — it covers only that element's own attributes and text, one level deep; mismatches in children still fail and real bugs get hidden.