Creating SPA’s using C#

Just for the background SPA enables you to get a desktop app-like experience in a browser.

This is possible because of WASM (WebAssembly) which is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications.

Seeing the future of the web and how the web ecosystem is evolving day by day Microsoft being the pioneer doesn’t want to hold back So they came up with an experiment called blazor which is a SPA framework that takes code in C# and compile it to wasm wich browsers understand and in May 2020 Microsoft officially released its first stable version for production use.

Blazor gets loaded, parsed, and executed way faster compared to JavaScript.Because its binaries are lighter than the textual JS files and, therefore, faster to decode.

We can also use JavaScript with C# using JSInterop which enables us to use numerous JS Apis as well.

here is the example snippet is written in C#

Blazor has two variants

1- Remote renderer


  • Runs on the full .NET Core runtime

  • Fast development cycle

  • Small download size

  • Code is kept on the server and not downloaded to the client