Blazor WebAssembly components are the main building blocks for Blazor WebAssembly websites. Each component has 3 sections:
@code
section: contains UI logic.You can download the example code used in this topic on GitHub.
Blazor WebAssembly component is called Razor Component. Razor Component is a set of UI and its logic that can be reusable. For example, we have a HelloWorld
component. This component can stand alone or be put inside another component. Later on, all components will be put inside App.razor
and App.razor
will be rendered in the index.html
. This image illustrates how components are used in Blazor WebAssembly.
To create a component, in your Visual Studio, right click on a folder and select Add => Razor Component.
Moving on to the advanced topic of Razor Component, you will need to understand the following techniques: