Ever wondered about developing a client side web application without using Javascript or about building a Single Page Applications (SPA) or a Progressive Web Apps (PWA) using Dot Net? Well if your answer is yes, then you are in for a treat now. With Blazor, you can develop client side web applications like Single Page Applications(SPA) or Progressive Web Apps(PWA) using your existing knowledge of Dot Net without having to learn a new language to build client side applications and their UI Logic. In this article, we are going to discuss about Blazor and the various functionalities it offers to build client side web applications. FYI, you can also build desktop and mobile native applications using Blazor too.
What is Blazor?
Blazor is a web UI framework to build interactive client side web applications using C# rather than Javascript. Blazor uses Web Assembly because of which it no longer requires the installation of any additional plugins in the web browser or the need to convert your code to Javascript to run in the web browser.
What is Web Assembly?
Web Assembly is like the byte code for the web. This means that if your code can be converted into web assembly then it can easily run on any web browser with native speed. It was adopted as an open web standard way back in 2015 by major browser vendors who are a part of W3C.
Why should I care about it?
One of the first things that excited me about Blazor as a Dot Net Developer was, it allowed me to do full stack web application development using .Net without the necessity to learn a different language and its framework. And if that doesn’t make you happy then maybe the next line will: Even though you can write C# code to build the client side application and their UI logic but just in case you wanted to use some javascript code in your Blazor application, you can absolutely do that. Blazor provides you with a javascript interop to do that which means you can have the fun of both worlds at the same time. There are a bunch more reasons which are mentioned later in the advantages of using Blazor WebAssembly and Blazor Server section of this article.
How does Blazor work?
To discuss how Blazor works, we are going to take the example of the execution of a Blazor WebAssembly application. Unlike the Blazor Server, The Blazor WebAssembly starts the program execution in the web browser. So when the browser sends a request to our application, the blazor.webassembly.js gets executed, then it downloads the Mono DotNet runtime and all the application libraries used by the application. After downloading all the required resources, the blazor.webassembly.js set’s up the DOM by binding all the javascript interop between our applications DLLs and the UI components in the browser. And once all of the above steps are done, then the blazor.webassembly.js initializes the runtime to begin the program execution.

IMAD AYOUBPosted Mar 18, 2021, 9:23 PM
Nice article. Thanks a lot.