Understanding client-side routing
The routing and layout of Blazor are similar to the concept of Shell and navigation in the XAML world. In Chapter 5, Navigation using .NET MAUI Shell and NavigationPage, when we introduced navigation and Shell, we discussed the routing strategy of Shell. Shell provides a URI-based navigation experience that uses routes to navigate to the selected pages. The routing of Blazor is quite similar to that.
The routing of Blazor provides a way to switch from one Razor page to another. The rendering of Razor pages in BlazorWebView
is similar to web apps running in a browser.
In a classic web application, when we load an HTML page in a browser, the HTML page is retrieved from the web server. When we choose a different route, we load a new page from the server. For Single-Page Applications (SPAs), things work a little differently.
Blazor WebAssembly apps are SPAs. When the app is started, the app is loaded in a browser. After that, the navigation of...