Skip to content

Pass DotnetObjectReference to JS using [JSImport] API? #53866

Answered by javiercn
Matheos96 asked this question in Q&A
Discussion options

You must be logged in to vote

You can't use DotNetObjectReference with the JSImport API. That's the native webassembly specific interop mechanism, not the Blazor one. The moment you opt-in to use [JSImport] you lock yourself into webassembly only and that interop model.

Our recomendation is that unless you need to squeeze out the last drop of performance you stick with the Blazor interop model and only opt-in into the webassembly interop model as a progressive enhancement in the cases where you need it.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Matheos96
Comment options

@javiercn
Comment options

Answer selected by javiercn
@Matheos96
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area-blazor Includes: Blazor, Razor Components
3 participants