Riding the Blazor Train
No, No! Microsoft will not kill this one off :)
Many moons have passed since Microsoft killed off Silverlight - the cross-platform offering promising so much!! (In reality it did do a good job at the time!)
It isn’t just Microsoft of course, many vendors kill off reasonably good ideas - I guess cost/direction and so on.
But Blazor! it seems to be staying around - honestly! it really does. Certainly, it has had its own fair share of growing pains. The split between WASM (web-assembly) versions vs the server-based versions and which one to choose for the “correct” scenario.
Anyway, thanks to Carl Franklin (yes, Carl from DotNetRocks!) and his “Blazor Train”, here is a summary of the upcoming .NET 8 updates for Blazor - doesn’t look like this one is going away… famous last words?
So, as of .NET 7:
Blazor Server runs on the server, handling UI interactions, while Blazor WebAssembly runs in the browser. Blazor Server offers a faster load time, allows direct access to secure resources, and is great for low-power mobile devices. On the other hand, Blazor WebAssembly doesn't require a server, can run offline, and can be deployed on a CDN. However, it has a slower startup time and requires an API layer to access secure resources.
Blazor 8 is Microsoft's preferred option for building web applications in ASP.NET Core. Developers can create a Blazor web app without any UI interactions and then add the desired features without choosing a hosting model upfront. Some features that can be added include server-side rendering, enhanced navigation and form handling, streaming rendering, and static HTML generation.
Streaming rendering allows for an initial rendering of a page while asynchronous tasks are still in progress on the server. This helps display placeholder content to the user while data is being loaded, improving the overall user experience.
Blazor 8 also introduces the ability to render Blazor components outside of the ASP.NET Core environment, allowing developers to generate static HTML from a Blazor component and use it as desired.
The choice between Blazor Server and Blazor WebAssembly depends on factors such as load time, performance, and user interface latency demands. Blazor Server loads more quickly but may have slight delays due to network interactions. Blazor WebAssembly has slightly slower load time but offers low latency operations since the code executes locally on the device.
With the flexibility of Blazor 8, developers can choose the rendering model on a per-page or per-component basis. This allows for a mix of client-side and server-side rendering, offering more granular control over UI interactivity.
The Auto render mode combines the upfront performance of Blazor Server with the power and speed of Blazor WebAssembly. It starts with Blazor Server and automatically switches to Blazor WebAssembly once the required libraries have been downloaded and cached in the browser.
In conclusion, Blazor 8 in .NET offers a comprehensive solution for building web applications, allowing developers to create powerful apps without UI interactions and seamlessly add UI interactivity when needed. By leveraging features like server-side rendering, enhanced navigation, and form handling, developers can create efficient and responsive web apps.