Author : HASSAN MD TAREQ

What is Blazor?

Types

  • Server-side Blazor (Blazor server)
  • Client-side Blazor (Blazor WebAssembly)

Server side blazor

Blazor can run client logic on the server. Client UI events are sent back to the server using SignalR. Once execution completes, the required UI changes are sent to the client and merged into the DOM.

  • Application is built on top of ASP.NET Core as Razor components and uses SignalR.
  • Client uses JavaScript, constantly communicates with the server and render/manipulate DOM

Client side blazor

Client-side C# code directly in the browser, using WebAssembly. Because it’s real .NET running on WebAssembly, you can re-use code and libraries from server-side parts of your application.

  • Application is built on top of ASP.NET Core as Razor components
  • Application is run in browser itself as WebAssembly
  • Most modern browser supports WebAssembly (wasm)

See: WebAssembly

JavaScript interop

  • C# code can easily call JavaScript APIs and libraries
  • can use the large ecosystem of JavaScript libraries that exist for client side UI while writing your logic in C#
  • When using server-side code execution, Blazor takes care of seamlessly executing any JavaScript code on the client