title: Execute async method on button click in blazor
body: <p>I created a &quot;Razor Components&quot; project. I am trying to execute an asynchronous method when pressing a button, but could not figure out the syntax yet.</p>
  <p>This is my <strong>Index.razor</strong>:</p>
  <pre><code>@page &quot;/&quot;
  @inject GenericRepository&lt;Person&gt; PersonRepository 
  
  @foreach (var person in persons)
  {
      &lt;button onclick=&quot;@(() =&gt; Delete(person.Id))&quot;&gt;❌&lt;/button&gt;
  }
  
  @functions 
  {
      async void Delete(Guid personId)
      {
          await this.PersonRepository.Delete(personId);
      }
  }
  </code></pre>
  <p>When I click the button, nothing happens. I tried various return types (e.g. <code>Task</code>) and stuff, but cannot figure out how to make it work. Please let me know if I need to provide more information.</p>
  <p>Every documentation / tutorial only just works with non-async void calls on button click.</p>
  <p>Thanks in advance.</p>