What is routing?

Simply defined, it is moving or navigating between components. A pattern-matching process governs requests and determines what to do with each one.

Router

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

@page Directive

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”

Route Template

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.

@page “/” <h1> Hello, Blazor!</h1> Welcome to Blazor App

Route Constraints

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.

@page "/routecons/

NavLink Component

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.

2X faster apps development ! 

Syncfusion offers over 1,800 components and frameworks for WinForms, WPF, ASP.NET (MVC, Core), UWP, WinUI, .NET MAUI, Xamarin, Flutter, Blazor, JavaScript, Angular, Vue, and React that make developers’ work easier.