Understanding Razor components
Even though we have created and used Razor components in the last two chapters, we haven’t taken a closer look at Razor components yet. In this section, we will continue improving the app from the last chapter and dig deeper into Razor components to learn some key concepts about these components.
Blazor apps are built using Razor components. The first Razor component in our app is Main
and it is defined in Main.razor
, as shown here:
<Router AppAssembly="@typeof(Main).Assembly"> <Found Context="routeData"> <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> <FocusOnNavigate RouteData="@routeData" Selector="h1" /> </Found> <NotFound> <LayoutView Layout="@typeof(MainLayout)"> ...