Simply defined, it is moving or navigating between components. A pattern-matching process governs requests and determines what to do with each one.
In Blazor applications, the routing process to Razor components is enabled by the Router component. It is used in the App component of Blazor applications.
<Router
In Blazor, routing rules are crucial since they allow us to specify the exact component that should appear for a certain URL. The @page directive is used to configure these rules.
@page “/route1”
The route template is defined in the App.razor file. The @page directive is placed at the top of the component to define the route template. When the code is compiled, the @page directive will become a RouteAttribute.
A route constraint enables type matching on a route segment to a component. A future version of Blazor may allow more route limitations than the current version. Localization support is not yet available.
The NavLink component can be used to create HTML hyperlinks so that you don’t have to manage navigation programmatically.
NavLinkMatch.All: Active current URL matches. NavLinkMatch.Prefix: Active if any prefix of the current URL matches it.