JavaScript Interop in Blazor: IJSRuntime, Collocated JS Modules, DotNetObjectReference and What's New in .NET 10
In Blazor, JS is imported as a .razor.js module next to the component and called through an IJSObjectReference; calls from JS back to .NET use DotNetObjectReference and [JSInvokable], and since there is no JS during prerendering, calls start in OnAfterRenderAsync. In the Bookstore panel we build a Chart.js sales chart with .NET 10's InvokeConstructorAsync, GetValueAsync and SetValueAsync, and show an ISBN copy button, JSDisconnectedException and the 32 KB message limit with real output.
15 Nov 2026
·
12 min
·
8