From bb210377b907abbe34fc59adb9e56b9fa54d58e7 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Thu, 1 Aug 2024 08:05:07 -0400 Subject: [PATCH] Drop BWA coverage from JS-SPA article (#33223) --- .../blazor/components/js-spa-frameworks.md | 27 +++++++++++++------ .../javascript-interoperability/index.md | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/aspnetcore/blazor/components/js-spa-frameworks.md b/aspnetcore/blazor/components/js-spa-frameworks.md index d8b80e7524..76823baedb 100644 --- a/aspnetcore/blazor/components/js-spa-frameworks.md +++ b/aspnetcore/blazor/components/js-spa-frameworks.md @@ -14,6 +14,13 @@ uid: blazor/components/js-spa-frameworks This article covers how to render Razor components from JavaScript, use Blazor custom elements, and generate Angular and React components. +> [!NOTE] +> We recommend using the `blazor.server.js` (Blazor Server) and `blazor.webassembly.js` (Blazor WebAssembly) scripts when integrating Razor components into an existing JavaScript app until better support for the `blazor.web.js` (Blazor Web App) script is added in the future. For more information, see [RegisterCustomElement stopped working in Blazor 8 (`dotnet/aspnetcore` #53920)](https://github.com/dotnet/aspnetcore/issues/53920#issuecomment-2261507850). + + + ## Angular sample apps @@ -54,6 +61,8 @@ One or more initializer functions can be created and called by different compone The following example demonstrates the dynamic registration of the preceding `Quote` component with "`quote`" as the identifier. + * In a Blazor Server app, modify the call to in the `Program` file: @@ -81,8 +90,6 @@ The following example demonstrates the dynamic registration of the preceding `Qu }); ``` -:::moniker-end - * In a Blazor WebAssembly app, call on in the client-side `Program` file: ```csharp @@ -179,6 +186,8 @@ Using a [JavaScript initializer](xref:blazor/fundamentals/startup#javascript-ini `wwwroot/{PACKAGE ID/ASSEMBLY NAME}.lib.module.js`: + + ```javascript export function afterStarted(blazor) { let targetElement = document.getElementById('quoteContainer2'); @@ -260,6 +271,8 @@ The following examples are based on the `Counter` component from the Blazor proj :::moniker-end + + +:::moniker range=">= aspnetcore-7.0" ### Blazor Server registration @@ -317,10 +332,6 @@ builder.Services.AddServerSideBlazor(options => }); ``` -:::moniker-end - -:::moniker range=">= aspnetcore-7.0" - ### Blazor WebAssembly registration Take the following steps to register a root component as a custom element in a Blazor WebAssembly app. diff --git a/aspnetcore/blazor/javascript-interoperability/index.md b/aspnetcore/blazor/javascript-interoperability/index.md index 91cc2f2156..e27c8b938e 100644 --- a/aspnetcore/blazor/javascript-interoperability/index.md +++ b/aspnetcore/blazor/javascript-interoperability/index.md @@ -32,7 +32,7 @@ Further JS interop guidance is provided in the following articles: ## Compression for interactive server components with untrusted data -