UseBackButton gives you full control over how the "Back" button behaves within your single page activities of your Blazor app. Use it to make a UI back button, the browser back button, and native OS “back” gestures (Blazor Hybrid app), all result in the same behavior.
Declare a Func<Task> to bind to UseBackButton's OnClickHandler and define function to handle back button navigation.
@code { // UseBackButton will set this function protected Func<Task> BackButtonClickHandler { get; set; } = null!; // function to handle back button event private bool OnBack() { // Return false if the page navigation should proceed as normal // else // do component navigation and return true. } }<UseBackButton OnBack="OnBack" @bind-OnClickHandler="BackButtonClickHandler" /><button type="button" @onclick="BackButtonClickHandler"></button>