Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aspnetcore/blazor/advanced-scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In <xref:Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder> methods wi

```razor
@page "/built-content"
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer

<h1>Build a component</h1>

Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/blazor/call-web-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ The Blazor examples that demonstrate obtaining weather data from a server API ar
For server-side components in Blazor Web Apps that require interactivity, add Interactive Server rendering to the component:

```razor
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer
```

For client-side components in Blazor Web Apps that require interactivity, add Interactive WebAssembly rendering to the component:

```razor
@rendermode RenderMode.InteractiveWebAssembly
@rendermode InteractiveWebAssembly
```

:::moniker-end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The following `Daleks` component displays the cascaded values.

```razor
@page "/daleks"
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer

<h1>Root-level cascading value registration example</h1>

Expand Down Expand Up @@ -154,7 +154,7 @@ Wrap the markup of the `Routes` component in a [`CascadingValue`](xref:Microsoft
In the `App` component (`Components/App.razor`), adopt an interactive render mode for the entire app. The following example adopts Interactive Server rendering:

```razor
<Routes @rendermode="RenderMode.InteractiveServer" />
<Routes @rendermode="InteractiveServer" />
```

> [!NOTE]
Expand Down Expand Up @@ -217,7 +217,7 @@ The following component binds the `ThemeInfo` cascading value to a cascading par

```razor
@page "/themed-counter"
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer
@using BlazorSample.UIThemeClasses

<h1>Themed Counter</h1>
Expand Down
7 changes: 5 additions & 2 deletions aspnetcore/blazor/components/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1436,9 +1436,9 @@ Whitespace isn't preserved from the preceding markup:

:::moniker range=">= aspnetcore-6.0"

## Render static root Razor components
## Root component

A *root Razor component* is the first component loaded of any component hierarchy created by the app.
A *root Razor component* (*root component*) is the first component loaded of any component hierarchy created by the app.

:::moniker-end

Expand All @@ -1450,6 +1450,9 @@ In an app created from the Blazor Web App project template, the `App` component
app.MapRazorComponents<App>();
```

> [!NOTE]
> Making a root component interactive, such as the `App` component, isn't supported because the Blazor script may be evaluated multiple times.

:::moniker-end

:::moniker range=">= aspnetcore-6.0 < aspnetcore-8.0"
Expand Down
14 changes: 6 additions & 8 deletions aspnetcore/blazor/components/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ You can supply a default layout with the <xref:Microsoft.AspNetCore.Components.R

For more information, see <xref:blazor/components/layouts#apply-a-default-layout-to-an-app>.

Add an `App` component to the app, which serves as the root component for other components.
Add an `App` component to the app, which serves as the root component, which is the first component the app loads.

`Components/App.razor`:

Expand Down Expand Up @@ -154,7 +154,7 @@ In the ASP.NET Core project's `Program` file:
app.UseAntiforgery();
```

* Add `MapRazorComponents` to the app's request processing pipeline with the `App` component (`App.razor`) specified as the default root component. Place the following code before the the line that calls `app.Run`:
* Add `MapRazorComponents` to the app's request processing pipeline with the `App` component (`App.razor`) specified as the default root component (the first component loaded). Place the following code before the the line that calls `app.Run`:

```csharp
app.MapRazorComponents<App>();
Expand Down Expand Up @@ -188,7 +188,7 @@ Add the following `Counter` component to the app that adopts the Interactive Ser

```razor
@page "/counter"
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer

<PageTitle>Counter</PageTitle>

Expand Down Expand Up @@ -225,15 +225,13 @@ Add a package reference for the [`Microsoft.AspNetCore.Components.WebAssembly.Se

[!INCLUDE[](~/includes/package-reference.md)]

<!-- UPDATE 8.0 'Interactivity type' will change to 'Interactive render mode' at RTM -->

Create a donor Blazor Web App to provide assets to the app. Follow the guidance in the <xref:blazor/tooling> article, selecting support for the following template features when generating the Blazor Web App.

For the app's name, use the same name as the ASP.NET Core app, which results in matching app name markup in components and matching namespaces in code. Using the same name/namespace isn't strictly required, as namespaces can be adjusted after assets are moved from the donor app to the ASP.NET Core app. However, time is saved by matching the namespaces at the outset.

Visual Studio:

* For **Interactivity type**, select **Auto (Server and WebAssembly)**.
* For **Interactive render mode**, select **Auto (Server and WebAssembly)**.
* Set the **Interactivity location** to **Per page/component**.
* Deselect the checkbox for **Include sample pages**.

Expand Down Expand Up @@ -432,7 +430,7 @@ builder.Services.AddRazorComponents()

For more information on adding support for Interactive Server and WebAssembly components, see <xref:blazor/components/render-modes>.

In the `Program` file immediately after the call to map Razor Pages (<xref:Microsoft.AspNetCore.Builder.RazorPagesEndpointRouteBuilderExtensions.MapRazorPages%2A>), call <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A> to discover available components and specify the app's root component. By default, the app's root component is the `App` component (`App.razor`). Chain a call to `AddInteractiveInteractiveServerRenderMode` to configure the Server render mode for the app:
In the `Program` file immediately after the call to map Razor Pages (<xref:Microsoft.AspNetCore.Builder.RazorPagesEndpointRouteBuilderExtensions.MapRazorPages%2A>), call <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A> to discover available components and specify the app's root component (the first component loaded). By default, the app's root component is the `App` component (`App.razor`). Chain a call to `AddInteractiveInteractiveServerRenderMode` to configure the Server render mode for the app:

```csharp
app.MapRazorComponents<App>()
Expand Down Expand Up @@ -777,7 +775,7 @@ Create a `Pages` folder in the `Components` folder for routable components. The

```razor
@page "/counter"
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer

<PageTitle>Counter</PageTitle>

Expand Down
8 changes: 4 additions & 4 deletions aspnetcore/blazor/components/prerender.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ uid: blazor/components/prerender
-->

This article explains Razor component prerendering scenarios for server-rendered components in Blazor Web Apps.
Prerendering can improve [Search Engine Optimization (SEO)](https://developer.mozilla.org/docs/Glossary/SEO) by rendering content for the initial HTTP response that search engines can use to calculate page rank.

*Prerendering* is the process of initially rendering page content on the server without enabling event handlers for rendered controls. The server outputs the HTML UI of the page as soon as possible in response to the initial request, which makes the app feel more responsive to users. Prerendering can also improve [Search Engine Optimization (SEO)](https://developer.mozilla.org/docs/Glossary/SEO) by rendering content for the initial HTTP response that search engines use to calculate page rank.

## Persist prerendered state

Expand All @@ -35,7 +35,7 @@ Consider the following `PrerenderedCounter1` counter component. The component se

```razor
@page "/prerendered-counter-1"
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer
@inject ILogger<PrerenderedCounter1> Logger

<PageTitle>Prerendered Counter 1</PageTitle>
Expand Down Expand Up @@ -127,7 +127,7 @@ The following counter component example persists counter state during prerenderi

```razor
@page "/prerendered-counter-2"
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer
@implements IDisposable
@inject ILogger<PrerenderedCounter2> Logger
@inject PersistentComponentState ApplicationState
Expand Down
10 changes: 4 additions & 6 deletions aspnetcore/blazor/components/quickgrid.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ The `QuickGrid` component is a Razor component for quickly and efficiently displ

## Package

<!-- UPDATE 8.0 Remove the prerelease content from the 8.0 content ONLY (Lines 21 and 83). The package will always be prerelease for 7.0 apps. -->

Add a ***prerelease*** package reference for the [`Microsoft.AspNetCore.Components.QuickGrid`](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.QuickGrid) package. If using the .NET CLI to add the package reference, include the `--prerelease` option when you execute the [`dotnet add package` command](/dotnet/core/tools/dotnet-add-package).
Add a package reference for the [`Microsoft.AspNetCore.Components.QuickGrid`](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.QuickGrid) package.

[!INCLUDE[](~/includes/package-reference.md)]

Expand Down Expand Up @@ -55,7 +53,7 @@ For example, add the following component to render a grid.
```razor
@page "/quickgrid-example"
@using Microsoft.AspNetCore.Components.QuickGrid
@rendermode RenderMode.InteractiveServer
@rendermode InteractiveServer

<QuickGrid Items="@people">
<PropertyColumn Property="@(p => p.PersonId)" Sortable="true" />
Expand All @@ -78,7 +76,7 @@ For example, add the following component to render a grid.
}
```

The preceding example specifies server rendering (`@rendermode RenderMode.InteractiveServer`), which enables the `QuickGrid`'s interactive features. In this case, the only interactive feature is sortable columns.
The preceding example specifies server rendering (`@rendermode InteractiveServer`), which enables the `QuickGrid`'s interactive features. In this case, the only interactive feature is sortable columns.

For an example that uses an <xref:System.Linq.IQueryable> with Entity Framework Core as the queryable data source, see the [`SampleQuickGridComponent` component in the ASP.NET Core Basic Test App (`dotnet/aspnetcore` GitHub repository)](https://github.com/dotnet/aspnetcore/blob/main/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor).

Expand Down Expand Up @@ -115,7 +113,7 @@ Add a ***prerelease*** package reference for the [`Microsoft.AspNetCore.Componen
[!INCLUDE[](~/includes/package-reference.md)]

> [!NOTE]
> Because the `Microsoft.AspNetCore.Components.QuickGrid` package is an experimental package for .NET 7, the package remains in *prerelease* status forever for .NET 7 Blazor apps. The package reached production status for .NET 8. For more information, see an 8.0 or later version of this article.
> Because the `Microsoft.AspNetCore.Components.QuickGrid` package is an experimental package for .NET 7, the package remains in *prerelease* status forever for .NET 7 Blazor apps. The package reached production status for .NET 8 or later. For more information, see an 8.0 or later version of this article.

Add the following component to render a grid.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ cd ConsoleApp1

In a command shell in the `ConsoleApp1` folder, add package references for <xref:Microsoft.AspNetCore.Components.Web?displayProperty=fullName> and <xref:Microsoft.Extensions.Logging?displayProperty=fullName> to the console app:

<!-- UPDATE 8.0 Remove prerelease switches -->

```dotnetcli
dotnet add package Microsoft.AspNetCore.Components.Web --prerelease
dotnet add package Microsoft.Extensions.Logging --prerelease
dotnet add package Microsoft.AspNetCore.Components.Web
dotnet add package Microsoft.Extensions.Logging
```

In the console app's project file (`ConsoleApp1.csproj`), update the console app project to use the Razor SDK:
Expand Down
Loading