Blazor Server – Render Modes

There are three main render modes available in Blazor server. Those are ServerPrendered, Server, Static modes. With .Net 8, we have some more new render modes available which we will discuss in  future.

 

Serverprerendered: This is the default render mode when you create the Blazor application. This render mode will render all content on the server and deliver as part of the content when page downloads for the first time. Then it hooks SignalR to make sure all your changes will be pushed to and from the server. For example, if your initial page has component, it renders two times. First, it renders as part of the initial page load and second, it renders through SignalR. So, we have to be careful to use ServerPrerendered mode. If you have component on initial page loads which makes any database calls or if it has any complex logic, try to avoid using this rendered mode.

 

Server: This render mode send whole page by adding placeholders to components. Then it hooks up SignalR to render components.  Using this mode, components will get execute only once. So, use this render mode if you are using any component on initial page.

 

Static: This render mode will render component, but not raise any events. This is suitable for static data.