@page "/"
<CascadingValue Value="IncrementAmount">
<Template />
</CascadingValue>
<p>Parent Current count: @currentCount</p>
<p>
<button class="btn btn-success" @onclick="IncrementCount">
Parent Increment by @IncrementAmount
</button>
</p>
<p>
<button class="btn btn-danger" @onclick="AddTenToIncrement">
Add Ten to IncrementBy: @IncrementAmount
</button>
</p>
@code {
private int IncrementAmount = 10;
private int currentCount = 0;
private void AddTenToIncrement(){
IncrementAmount += 10;
}
private void IncrementCount()
{
currentCount = currentCount + IncrementAmount;
}
}