Blazor ref ke komponen di if

<button OnClick="Show">Show bla bla bla</button>

@if (IsVisible)
{
  <div @ref="MyRef">Bla bla bla</div>
}

@code {
  private bool IsVisible = false;
  ElementReference MyRef;
  
  public async Task Show()
  {
    IsVisible = true;
    
    // Wait for the Renderer service empty it's queue
    // or in another words: 
    // wait for the non rendered element to apply its reference
    StateHasChanged();
    await Task.Yield();
    
    var anotherRef = MyRef;
  }
}
Av3