Blazor Server-Side Rendering
Static server-side rendering (static SSR) is the default in a Blazor Web App: components render to HTML on the server, like a classic web page.
On this page · 5 min · Beginner
On this page
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Beginner
- Updated
- Oct 29, 2026
Learning objectives#
- Explain static SSR and when to use it
- Use streaming rendering for slow data
- Handle forms without interactivity
- Understand enhanced navigation
Explanation#
With static SSR a component renders once per request to plain HTML. No WebSocket and no WebAssembly download — great for content pages and SEO.
Enhanced navigation intercepts link clicks and form posts, fetches the new page and patches the DOM, so the site feels like a single-page app.
[StreamRendering] sends the page shell immediately, then streams the content when async work finishes.
Forms work with standard posts: give EditForm a FormName and bind the model with [SupplyParameterFromForm].
Code example: A streamed product page#
@page "/products"
@attribute [StreamRendering]
@inject IProductService Products
<h1>Products</h1>
@if (items is null)
{
<p>Loading…</p>
}
else
{
<ul>
@foreach (var p in items)
{
<li>@p.Name — ₹@p.Price</li>
}
</ul>
}
@code {
private List<Product>? items;
protected override async Task OnInitializedAsync() => items = await Products.GetAllAsync();
}
The browser first receives “Loading…”, then the product list replaces it in the same response once the data is ready.
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- No @rendermode, so the page is static SSR.
- [StreamRendering] flushes the initial HTML before OnInitializedAsync finishes.
- When the data arrives, Blazor streams the updated markup.
- The output is real HTML that search engines can index.
Real-world use case#
Product catalogues, blog posts and documentation pages — fast, indexable, and cheap to host because no per-user connection is held.
Common mistakes#
They never fire. Use links and forms, or make that component interactive.
Only interactive parts need a render mode. Keep content pages static.
Best practices#
- Default to static SSR for content
- Use [StreamRendering] for slow queries
- Add interactivity only to components that need it
- Use SSR forms with FormName for simple submissions
Remember this#
Static SSR = HTML per request, no circuit.
[StreamRendering] = shell now, data later.
Events need an interactive render mode.
Practice exercise#
Your task: What attribute lets a static page show “Loading…” before the data is ready?
Show solution
@attribute [StreamRendering]
Mini quiz#
Static SSR pages keep a SignalR connection open for each user.
Want more? Practise all Blazor MCQs · Blazor interview questions
My notes#
Saved in this browser.