Skip to content

Commit 433b86e

Browse files
authored
[Blazor] Calling .NET from JS - explanation of scenarios for DotNetObjectReference and instance methods (#33910)
1 parent 4a78bf3 commit 433b86e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

aspnetcore/blazor/javascript-interoperability/call-dotnet-from-javascript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,14 @@ In the preceding example:
11691169

11701170
## Component instance .NET method helper class
11711171

1172-
A helper class can invoke a .NET instance method as an <xref:System.Action>. Helper classes are useful in the following scenarios:
1172+
A helper class can invoke a .NET instance method as an <xref:System.Action>. Helper classes are useful in scenarios where using static .NET methods aren't applicable:
11731173

11741174
* When several components of the same type are rendered on the same page.
11751175
* In server-side apps with multiple users concurrently using the same component.
11761176

11771177
In the following example:
11781178

1179-
* The component contains several `ListItem1` components, which is a shared component in the app's `Shared` folder.
1179+
* The component contains several `ListItem1` components.
11801180
* Each `ListItem1` component is composed of a message and a button.
11811181
* When a `ListItem1` component button is selected, that `ListItem1`'s `UpdateMessage` method changes the list item text and hides the button.
11821182

@@ -1345,7 +1345,7 @@ The assignment of a <xref:Microsoft.JSInterop.DotNetObjectReference> to a proper
13451345
* In the component's [`OnAfterRender{Async}` method](xref:blazor/components/lifecycle#after-component-render-onafterrenderasync), a JavaScript (JS) function is invoked with the element reference and the component instance as a <xref:Microsoft.JSInterop.DotNetObjectReference>. The JS function attaches the <xref:Microsoft.JSInterop.DotNetObjectReference> to the element in a property.
13461346
* When an element event is invoked in JS (for example, `onclick`), the element's attached <xref:Microsoft.JSInterop.DotNetObjectReference> is used to call a .NET method.
13471347

1348-
Similar to the approach described in the [Component instance .NET method helper class](#component-instance-net-method-helper-class) section, this approach is useful in the following scenarios:
1348+
Similar to the approach described in the [Component instance .NET method helper class](#component-instance-net-method-helper-class) section, this approach is useful in scenarios where using static .NET methods aren't applicable:
13491349

13501350
* When several components of the same type are rendered on the same page.
13511351
* In server-side apps with multiple users concurrently using the same component.

0 commit comments

Comments
 (0)