What is Blazor?
Blazor is an open-source framework for building client-side web applications using C# and HTML. This
technology is developed by Microsoft and the name comes from a combination of two words Browser
and Razor. Blazor runs on most of the modern web and mobile browsers.
Blazor mainly has four hosting models. Currently only Blazor server and Blazor Web Assembly have been released.
Blazor Server apps host Blazor components on the server and handle UI interactions over a real-time SignalR connection. The user interacts with the app, the UI events are sent to the server over the connection to be handled by the varied components that structure the app.
When a component handles a UI event, it’s rendered supported its updated state. Blazor compares the newly rendered output with what was rendered previously and send the changes back to the browser and applies them to the DOM.
Blazor Web Assembly
Blazor Web Assembly apps host components within the browser employing a Web Assembly-based .NET runtime. The components handle UI events and execute their rendering logic directly within the browser.
Blazor Web Assembly apps use only open web standards to run .NET code client-side, without the necessity for any browser plugins or code transpiration. a bit like with Blazor Server apps, the Blazor framework handles comparing the newly rendered output with what was rendered previous and updates the DOM accordingly, but with Blazor Web Assembly the UI rendering is handled client-side.
PWAs are web apps that leverage the newest web standards to incorporate a more native-like experience. PWAs can support offline scenarios, push notifications, and OS integrations, like support for pinning the app to your home screen or the Windows Start menu
A Blazor Native app runs natively on the devices and uses a similar UI abstraction to render native controls for that device. this is often very almost like how frameworks like Xamarin Forms or React Native work today.
Components in Blazor consist of C# for dynamic rendering logic and HTML for designing functionality-rich user interfaces. These are flexible and lightweight components of the blazer and can be employed again to build similar applications.
It is a predominant feature of blazer that enables routing with the help of a client-side server. The pattern matching process detects all the requests, then process them and regulate the requests.
Developers can use Dependency injection to insert services into Blazor to execute dynamic operations or carry out unit testing by incorporating mockup services.
As a part of MVC Framework Blazor support Forms and Validations by utilizing Data Annotations in its client-side router. So, it is quite easy to validate forms on Blazor.
Web Applications developed on Blazor are stateful and allows to save the user’s state in the server’s memory.
Debugging supports is offered in Blazor Web Assembly applications by employing browser dev tools in Chromium-based browsers.
Using the bind attributes you can easily bind components and DOM in Blazor. Blazor offers various types of binding; one way, two way, and event data binding.