Reputation: 314
What is the difference between Tag Helper and Blazor in Asp.net core.
Tag Helper intoroduced in asp.net core 2.0 and Blazor introduced in Asp.net core 3.0.
Upvotes: 1
Views: 661
Reputation: 91
Tag Helpers are Razor page specific. Blazor uses components. From the usage perspective, they both look same. For example, when you have a tag helper, you can use that same like an HTML element where the tag helper properties can be used like regular HTML attributes.
Blazor uses components. And components can be used same like HTML elements too. A component's properties can be accessed like an HTML attribute. So, when someone look into the usage code, he/she wont be bale to differentiate if an element is a Blazor component or tag helper.
But, the way tag helper is created is different than blazor. Tag helpers render pure HTML but the Blazor component is not directly an HTML renderer. Rather Blazor component works integrated with the Blazor ecosystem. Theoretically, a razor page tag helper should have been usable in Blazor, but until today, Blazor cannot recognize Razor tag helpers (which is unfortunate). On the contrary, a blazor component can be used within the Razor page using the component element. For example, here is a sample usage of the Blazor component within Razor pages.
<app>
<component type="typeof(BugDetails)" param-IpAddress="2.36.3.12" param-Id="3" render-mode="Server" />
</app>
Here, the BugDetails is the name of the Blazor component, and IpAddress, Id, etc are the properties of the component.
Upvotes: 2