-
Book Overview & Buying
-
Table Of Contents
Web Development with Blazor - Fourth Edition
By :
To bring Blazor into an existing Angular or React site, we use the Custom Elements feature. It was introduced as an experimental feature in .NET 6 and has been a part of the framework since .NET 7.
The idea is to create parts of your site in Blazor without having to migrate fully over to Blazor.
When working with Custom Elements, it's important to understand that we are crossing the boundary between Blazor and standard web platform features.
The RegisterCustomElement call exposes a Blazor component as a native browser custom element. From the outside, it behaves like any other HTML tag, but under the hood, it still needs the Blazor runtime to function.
Because of that, we also need to make sure the required Blazor framework files and JavaScript runtime are available to the page where the custom element is used. This is why we need to add some JavaScript and configure how resources are loaded in the upcoming steps.
For this feature to work, we need an ASP...