.NET › Blazor (Server & WebAssembly)
What is prerendering in Blazor, and what problem does it solve for initial page load experience?
AdvancedAnswer
Prerendering renders a component's initial HTML output on the server (without full interactivity yet) and sends it as part of the initial HTTP response, so users see meaningful content immediately instead of a blank page while the Blazor runtime (SignalR connection or WASM download) initializes -- once the client-side runtime is ready, Blazor 'hydrates' the prerendered markup into a fully interactive component, ideally without a visible flash or layout shift.
// .NET 8 unified model: prerendering configured via render mode parameters
@rendermode @(new InteractiveServerRenderMode(prerender: true))
// Or globally for WebAssembly
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: true))Real-world example A public-facing Blazor WebAssembly app enables prerendering so search engine crawlers and users on slow connections see fully rendered initial content immediately, rather than a blank page during the multi-second WASM runtime download.