We need to talk about Blazor
Blazor is a .NET based web application technology that allows you to build interactive applications leveraging C#, Razor, and HTML. The web app builder, Blazor, compiles to WebAssembly known as Wasm for short. This enables the new emerging technology to run in any modern web browser with great performance.
.NET in WebAssembly
The ability to compile the .NET Framework in Wasm gives us a whole new world of possibilities. Using Blazor we have the power of the .NET runtime and standard .NET libraries to our advantage within a browser, everything behaves exactly like .NET on the desktop or server.
Blazor VS … everything else
Server-Side vs Client-Side
Blazor comes in two main flavors, Server-Side and Client-Side. Server-side serves your single page application to the browser using Signal R. This approach gives us the full advantage of server-side execution, decreases initial download time and supports thin clients, meaning it will work on browsers that do not support web assembly or has resource constraints. The app and its components are not served to the client.
Personally, for me, the exciting part about Blazor is the ability to run the single page application client-side. The application is able to run independently on a clients device or browser with no dependency to the server. Because of the disadvantages associated with client-side architecture like downloading the .NET runtime including your application (compiled to Wasm) to the client, I would not recommend using this approach for general browser-based applications. However, the utilization of the Client-Side approach has just become very interesting from a mobile perspective.
Using both approaches we can share standard .NET libraries between two shell projects( server and client). We could develop a single login component or any other UI or backend component and reuse it in both server-side and client-side shell applications. Modularity is a great advantage when using Blazor.
As described on the GitHub page BlazorMobile – is a set of Nuget packages & project templates for embedding a Blazor web application as a standalone mobile application, hosted in Xamarin with native communication support.
The Client-Side shell compiles to a zip file and is then embedded within a Xamarin application at compile time. To use native functionality, a proxy interface can be added to a shared project between Blazor and Xamarin. The concrete implementation of the proxy interface is placed in a shared Xamarin project, available to the iOS, Android, UWP & Desktop shell projects. From the Blazor implementation the proxy interface is injected and called when required.
I think a question on everyone’s minds is, will Blazor replace Frameworks like React, Vue, and Angular? In my opinion, this new exciting technology is definitely going to be a strong competitor with its ability to increase development speed and modularity. Building single-page applications with Blazor is surprisingly simple with a straight forward approach. There are no surprises or unexpected behavior, leaving us with a seamless development experience.