title: How to call C# none static method in Blazor component from JS file with parameter?
body: <p>The Microsoft <a href="https://docs.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/call-dotnet-from-javascript?view=aspnetcore-5.0#component-instance-examples" rel="nofollow noreferrer">docs</a> explains how to call a component instance methods from a JS code with parameter. In the example, the function in JS file calls from Blazor component by IJSRuntime.</p>
  <pre><code>// In  razor component
  public async Task TriggerDotNetInstanceMethod()
  {
      objRef = DotNetObjectReference.Create(this);
      result = await JS.InvokeAsync&lt;string&gt;(&quot;sayHello2&quot;, objRef, name);
  }
  
  [JSInvokable]
  public string GetHelloMessage(string passedName) =&gt; $&quot;Hello, {passedName}!&quot;;
  
  // In JS file.
  &lt;script&gt;
     window.sayHello2 = (dotNetHelper, name) =&gt; {
     return dotNetHelper.invokeMethodAsync('GetHelloMessage', name);
   };
  &lt;/script&gt;
  </code></pre>
  <p>My question is how to call the JSInvokable C# method in a Blazor component with parameter from a JS file by an event. For example, Google map API returns a response with an address and coordinates through an event inside the map in a JS file. I want to pass these details to a none static method in a razor component to have more process on them.</p>