Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply 62 React and Next.js performance optimization rules from Vercel Engineering
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/rendering-hydration-suppress-warning.md
1---2title: Suppress Expected Hydration Mismatches3impact: LOW-MEDIUM4impactDescription: avoids noisy hydration warnings for known differences5tags: rendering, hydration, ssr, nextjs6---78## Suppress Expected Hydration Mismatches910In SSR frameworks (e.g., Next.js), some values are intentionally different on server vs client (random IDs, dates, locale/timezone formatting). For these *expected* mismatches, wrap the dynamic text in an element with `suppressHydrationWarning` to prevent noisy warnings. Do not use this to hide real bugs. Don’t overuse it.1112**Incorrect (known mismatch warnings):**1314```tsx15function Timestamp() {16return <span>{new Date().toLocaleString()}</span>17}18```1920**Correct (suppress expected mismatch only):**2122```tsx23function Timestamp() {24return (25<span suppressHydrationWarning>26{new Date().toLocaleString()}27</span>28)29}30```31