Skip to content

Commit 140d8ac

Browse files
authored
Move and patch two Blazor sections (#18008)
1 parent 4d427dd commit 140d8ac

2 files changed

Lines changed: 49 additions & 53 deletions

File tree

aspnetcore/blazor/hosting-model-configuration.md

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about Blazor hosting model configuration, including how to in
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 04/23/2020
8+
ms.date: 04/25/2020
99
no-loc: [Blazor, SignalR]
1010
uid: blazor/hosting-model-configuration
1111
---
@@ -295,53 +295,6 @@ Blazor Server apps are set up by default to prerender the UI on the server befor
295295

296296
Rendering server components from a static HTML page isn't supported.
297297

298-
### Render stateful interactive components from Razor pages and views
299-
300-
Stateful interactive components can be added to a Razor page or view.
301-
302-
When the page or view renders:
303-
304-
* The component is prerendered with the page or view.
305-
* The initial component state used for prerendering is lost.
306-
* New component state is created when the SignalR connection is established.
307-
308-
The following Razor page renders a `Counter` component:
309-
310-
```cshtml
311-
<h1>My Razor Page</h1>
312-
313-
<component type="typeof(Counter)" render-mode="ServerPrerendered"
314-
param-InitialValue="InitialValue" />
315-
316-
@code {
317-
[BindProperty(SupportsGet=true)]
318-
public int InitialValue { get; set; }
319-
}
320-
```
321-
322-
### Render noninteractive components from Razor pages and views
323-
324-
In the following Razor page, the `Counter` component is statically rendered with an initial value that's specified using a form:
325-
326-
```cshtml
327-
<h1>My Razor Page</h1>
328-
329-
<form>
330-
<input type="number" asp-for="InitialValue" />
331-
<button type="submit">Set initial value</button>
332-
</form>
333-
334-
<component type="typeof(Counter)" render-mode="Static"
335-
param-InitialValue="InitialValue" />
336-
337-
@code {
338-
[BindProperty(SupportsGet=true)]
339-
public int InitialValue { get; set; }
340-
}
341-
```
342-
343-
Since `MyComponent` is statically rendered, the component can't be interactive.
344-
345298
### Configure the SignalR client for Blazor Server apps
346299

347300
Sometimes, you need to configure the SignalR client used by Blazor Server apps. For example, you might want to configure logging on the SignalR client to diagnose a connection issue.

aspnetcore/blazor/integrate-components.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about data binding scenarios for components and DOM elements
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 04/14/2020
8+
ms.date: 04/25/2020
99
no-loc: [Blazor, SignalR]
1010
uid: blazor/integrate-components
1111
---
@@ -237,11 +237,54 @@ For more information on namespaces, see the [Component namespaces](#component-na
237237

238238
To render a component from a page or view, use the [Component Tag Helper](xref:mvc/views/tag-helpers/builtin-th/component-tag-helper).
239239

240-
For more information on how components are rendered, component state, and the `Component` Tag Helper, see the following articles:
240+
### Render stateful interactive components
241241

242-
* <xref:blazor/hosting-models>
243-
* <xref:blazor/hosting-model-configuration>
244-
* <xref:mvc/views/tag-helpers/builtin-th/component-tag-helper>
242+
Stateful interactive components can be added to a Razor page or view.
243+
244+
When the page or view renders:
245+
246+
* The component is prerendered with the page or view.
247+
* The initial component state used for prerendering is lost.
248+
* New component state is created when the SignalR connection is established.
249+
250+
The following Razor page renders a `Counter` component:
251+
252+
```cshtml
253+
<h1>My Razor Page</h1>
254+
255+
<component type="typeof(Counter)" render-mode="ServerPrerendered"
256+
param-InitialValue="InitialValue" />
257+
258+
@functions {
259+
[BindProperty(SupportsGet=true)]
260+
public int InitialValue { get; set; }
261+
}
262+
```
263+
264+
For more information, see <xref:xref:mvc/views/tag-helpers/builtin-th/component-tag-helper>.
265+
266+
### Render noninteractive components
267+
268+
In the following Razor page, the `Counter` component is statically rendered with an initial value that's specified using a form. Since the component is statically rendered, the component isn't interactive:
269+
270+
```cshtml
271+
<h1>My Razor Page</h1>
272+
273+
<form>
274+
<input type="number" asp-for="InitialValue" />
275+
<button type="submit">Set initial value</button>
276+
</form>
277+
278+
<component type="typeof(Counter)" render-mode="Static"
279+
param-InitialValue="InitialValue" />
280+
281+
@functions {
282+
[BindProperty(SupportsGet=true)]
283+
public int InitialValue { get; set; }
284+
}
285+
```
286+
287+
For more information, see <xref:xref:mvc/views/tag-helpers/builtin-th/component-tag-helper>.
245288

246289
## Component namespaces
247290

0 commit comments

Comments
 (0)