Skip to content

Commit 600ac88

Browse files
authored
Clarify element reference remark (#20235)
1 parent 7b933b4 commit 600ac88

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ public static ValueTask<T> GenericMethod<T>(this ElementReference elementRef,
244244

245245
## Reference elements across components
246246

247-
An <xref:Microsoft.AspNetCore.Components.ElementReference> is only guaranteed valid in a component's <xref:Microsoft.AspNetCore.Components.ComponentBase.OnAfterRender%2A> method (and an element reference is a `struct`), so an element reference can't be passed between components.
248-
249-
For a parent component to make an element reference available to other components, the parent component can:
247+
An <xref:Microsoft.AspNetCore.Components.ElementReference> instance is only guaranteed valid in a component's <xref:Microsoft.AspNetCore.Components.ComponentBase.OnAfterRender%2A> method (and an element reference is a `struct`), so an element reference can't be passed between components. For a parent component to make an element reference available to other components, the parent component can:
250248

251249
* Allow child components to register callbacks.
252250
* Invoke the registered callbacks during the <xref:Microsoft.AspNetCore.Components.ComponentBase.OnAfterRender%2A> event with the passed element reference. Indirectly, this approach allows child components to interact with the parent's element reference.

0 commit comments

Comments
 (0)