Override the ShouldRender method to suppress UI rendering. If the implementation returns true, the UI is refreshed. Initial rendering cannot be prevented using this method.
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
private bool shouldRender = true;
private void IncrementCount()
{
shouldRender = false;
currentCount++;
}
protected override bool ShouldRender()
{
return shouldRender;
}
}
More information about suppressing UI rendering can be found here.
Share with