.Net 8 and Blazor Render Modes Changes


With the release of .Net 8, Blazor got some great updates. Blzoar is now a full-featured development system.  With the latest Blazor, you can build websites, web applications, desktop applications, Progressive Web Applications, tablet applications, and even mobile applications.  That is a long list of things you can build with Blazor and C#.


Render Modes

.Net 8 has added new render mores and has made great improvements to the old render modes.  These changes have really pushed Blazor to new heights of building great applications.

The old render modes are server and web assembly.  

Server mode 

This mode would use SingleR to open web sockets to the server.  In this mode, everything is compiled on the server and sends just the changes to the client.  It allows you to isolate your code to the server and keep your code secure.  The downside is that it can get expensive to scale to handle a large amount of users.


Web Assembly

This mode allows everything to be executed on the client. On the bright side, you use fewer server resources and can scale infinitely.  The downside is that all your code is downloaded to the client before it can begin to be executed. Also, since the code is on the client, it is not secured.  


New render modes

Not only are the old render methods supported, but there are also three new ones, Server Side Rendering, Streaming, and Hybrid


Server Side Rendering (SSR)

Positive of this render Method:

1. Everything is processed on the server

2. Very quick to load

3. Direct access to server resources

4. Code is secure


The downside of this Render Method:

1. There are no client intersections


This is a great render method to use when building static websites.  Adds very little overhead for static websites.


Streaming Rendering

This render method adds a new way to add user interactivity to Blazor pages and components.  Can code your page or even a component that when using SSR can add user interactions.  

This is great to use if you have a static website with small sections that could require user input such as a feedback form or a contact us form.


Hybrid Render Mode (Auto)

The best new render mode is a hybrid, a mixture of all the render modes.  This allows your application to take advantage of the fast load of server mode but allows you to download application code to the client in the background and then take advantage of processing on the client.  If your web assembly client needs secure code executed you can code it so that the component runs on the server where the code is secure


How to set/change the render mode

Not only can you set the render mode for the entire application, but it allows you to change and set it at the page and even the component level.  This is a powerful change,

You set the render mode with attributes and by injecting the render mode.


Summary

You can tailor your application for performance, security, scalability, and usability with so many render modes.

With this new customization, you need to do more design on how and when to use rendering methods in your applications.

Comments

Popular posts from this blog

Yes, Blazor Server can scale!

Blazor new and improved Search Box

Blazor - Displaying an Image