Skip to content

Commit c6f5ea6

Browse files
authored
Merge pull request #18021 from dotnet/master
2 parents 6d271f4 + 77a5b97 commit c6f5ea6

4 files changed

Lines changed: 53 additions & 56 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

aspnetcore/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@
299299
uid: blazor/data-binding
300300
- name: Event handling
301301
uid: blazor/event-handling
302+
- name: Lifecycle
303+
uid: blazor/lifecycle
302304
- name: Templated components
303305
uid: blazor/templated-components
304306
- name: Integrate components
305307
uid: blazor/integrate-components
306308
- name: Globalization and localization
307309
uid: blazor/globalization-localization
308-
- name: Lifecycle
309-
uid: blazor/lifecycle
310310
- name: Layouts
311311
uid: blazor/layouts
312312
- name: Forms and validation

aspnetcore/tutorials/build-your-first-blazor-app/samples_snapshot/3.x/FetchData1_client.razor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
protected override async Task OnInitializedAsync()
66
{
77
forecasts =
8-
await Http.GetJsonAsync<WeatherForecast[]>("sample-data/weather.json");
8+
await Http.GetFromJsonAsync<WeatherForecast[]>(
9+
"sample-data/weather.json");
910
}

0 commit comments

Comments
 (0)