How to use JS Interop with Blazor
One of the main benefits of working with blazor is that you can use C# both server side and client side. It allows frontend and backend developers to share a single codebase (something that was only possible with javascript before). This feature is possible because of Web Assembly which gives .NET a low level language to target when compiling C#. One issue with Web Assembly is that it is still in development and doesn’t have direct access to the DOM like javascript does. So calls to the DOM need to be handled with an IJSRuntime interface which allows developers to call JavaScript functions from .NET methods and vice-versa. ...