[Blazor] Event handling - first InvokeAsync example with args (#32085)

pull/32103/head
Robert Haken 2024-03-20 11:45:37 +01:00 committed by GitHub
parent 61dc10178c
commit 53cabce5c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -635,9 +635,11 @@ Prefer the strongly typed <xref:Microsoft.AspNetCore.Components.EventCallback%60
Invoke an <xref:Microsoft.AspNetCore.Components.EventCallback> or <xref:Microsoft.AspNetCore.Components.EventCallback%601> with <xref:Microsoft.AspNetCore.Components.EventCallback.InvokeAsync%2A> and await the <xref:System.Threading.Tasks.Task>:
```csharp
await OnClickCallback.InvokeAsync();
await OnClickCallback.InvokeAsync({ARGUMENT});
```
In the preceding example, the `{ARGUMENT}` placeholder is an optional argument.
The following parent-child example demonstrates the technique.
`Child2.razor`: