ssr
Hydration, TransferState, and Prerendering standards.
Files2
View on GitHubSKILL.mdskills/angular/ssr
GitHubSSR (Server-Side Rendering)
Priority: P2 (MEDIUM)
Principles
- Hydration: Enable Client Hydration in
app.config.ts. - Platform Checks: Use
afterNextRenderorafterRenderfor browser-only code (e.g., accessingwindow). - TransferState: Use
makeStateKeyandTransferStateto prevent double-fetching data on client.
Guidelines
- Browser Objects: Never access
window,document, orlocalStoragedirectly in component logic. Implement abstractions or useafterNextRender. - Prerendering: Use SSG for static pages (Marketing, Blogs).