Author : MD TAREQ HASSAN | Updated : 2020/07/04
What is Blazor?
- Blazor is a framework for building interactive client-side web UI with .NET using C# instead of JavaScript
- Blazor is a Single Page Application development framework
- Blazor lets you build interactive web UIs using C# instead of JavaScript
- Blazor is a free and open-source web framework that enables developers to create web apps (SPA) using C# and HTML
- The name Blazor is a combination/mutation of the words Browser and Razor (the .NET HTML view generating engine)
- Blazor is a new client-side UI framework from the ASP.NET team
- Links:
Types
- Blazor server (Server-side Blazor)
- Blazor WebAssembly (Client-side Blazor)
Blazor server
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
Blazor WebAssembly
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)
WebAssembly
- See: WebAssembly
- Links:
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