Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to communicate between server components and WASM components

$
0
0

Let's say I have a WASM component in my .Client project called "Counter", and I embed it on a server page. How do communicate with the component? I want to do something like this:

<Counter @ref=_counter></Counter>@code {    Counter _counter;    protected override void OnInitialized()    {        _counter.MethodCall();        base.OnInitialized();    }}

Solution explorer

But if i do, i get this exception, because of the @ref=_counter

System.InvalidCastException: 'Unable to cast object of type'Microsoft.AspNetCore.Components.Endpoints.SSRRenderModeBoundary' totype 'Blazor9Test.Client.Pages.Counter'.'


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>