How is a Blazor app's root wired up: what are the roles of App.razor, the Routes/Router component, and MapRazorComponents?

Last updated 5 July 2026

  • App.razor is the root component: in .NET 8+ it renders the full HTML document and hosts <Routes /> plus script references.

  • The Router (usually in Routes.razor) maps URLs to @page components: Found renders the page via RouteView with a default layout, and NotFound handles unmatched URLs.

  • MapRazorComponents<App>() in Program.cs registers the root component as an endpoint and enables render modes (e.g. AddInteractiveServerRenderMode()).

  • https://learn.microsoft.com/en-us/aspnet/core/blazor/project-structure?view=aspnetcore-10.0
  • https://learn.microsoft.com/de-de/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-10.0
  • https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-10.0
  • https://github.com/dotnet/aspnetcore/issues/47312
  • https://www.telerik.com/blogs/unified-blazor-web-app-project-template-fully-explained
  • https://blazor-university.com/routing/defining-routes/
  • https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-10.0
All Blazor interview questions