next.js
bb44b762 - docs: clarify hydration and flash tradeoffs (#101798)

Commit
4 hours ago
docs: clarify hydration and flash tradeoffs (#101798) ## Summary Clarify when preventing a flash needs an inline script and when a server-rendered fallback is enough. The date example formats the fallback once on the server and passes that label to the Client Component. The browser can then show a localized date without a hydration mismatch. Keep the choice in the Preventing Flash guide’s existing “When to use other approaches” section. Link to the SPA guide for browser-only rendering, React for external-store subscriptions and the effect workaround, and #102472 for components first loaded after an interaction. The hydration error page links back to the fallback example. This PR is stacked on #102472. Also mark the reusable inline-script helper and the `ssr: false` example as Client Components, and use React’s `dateTime` prop. ## Verification - [Hosted Chromium](https://github.com/aurorascharff/reproductions/actions/runs/46010222993) verified the retained date example: a server-formatted fallback appears in the HTML and the browser formats the date during hydration without an error. Both remaining code blocks are unchanged from that run. - Previously reproduced the inline-script warning on Next.js 16.4.3 with Turbopack and verified the helper preserves initial execution and does not warn when a soft navigation returns to the layout. - All 45 JS/TS snippets parse and pass the React purity, refs, and set-state-in-effect checks. All 52 internal links resolve. Targeted MDX ESLint, Prettier, and diff checks pass. <!-- NEXT_JS_LLM -->
Author
Parents
Loading