Skip to content

Commit 41ef8b8

Browse files
committed
Updates
1 parent 0bb2f21 commit 41ef8b8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aspnetcore/blazor/components/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,14 +1071,14 @@ For more information, see <xref:mvc/views/razor>.
10711071
> [!WARNING]
10721072
> Providing initial values for component parameters is supported, but don't create a component that writes to its own parameters after the component is rendered for the first time. For more information, see <xref:blazor/components/overwriting-parameters>.
10731073
1074-
Component parameters should be declared as *auto-properties*, meaning that they shouldn't contain custom logic in their `get` or `set` accessors. For example, the following `StartData` property is an auto-property:
1074+
Component parameters should be declared as [automatically-implemented properties (*auto properties*)](/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties), meaning that they shouldn't contain custom logic in their `get` or `set` accessors. For example, the following `StartData` property is an auto property:
10751075

10761076
```csharp
10771077
[Parameter]
10781078
public DateTime StartData { get; set; }
10791079
```
10801080

1081-
Don't place custom logic in the `get` or `set` accessor because component parameters are purely intended for use as a channel for a parent component to flow information to a child component. If a `set` accessor of a child component property contains logic that causes rerendering of the parent component, an infinite rendering loop results.
1081+
Don't place custom logic in the `get` or `set` accessor because component parameters are purely intended for use as a channel for a parent component to flow information to a child component. If a `set` accessor of a child component property contains logic that causes rerendering of the parent component, an infinite rendering loop results. Other side effects include unexpected extra renderings and parameter value overwrites.
10821082

10831083
To transform a received parameter value:
10841084

aspnetcore/diagnostics/bl0007.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ A [component parameter](xref:blazor/components/index#component-parameters), whic
2323

2424
A component parameter is a framework-managed communication channel between a parent and a child component. Developers shouldn't write to the parameter in a [set accessor/setter (`set`)](/dotnet/csharp/programming-guide/classes-and-structs/using-properties#the-set-accessor), either from inside or outside the component.
2525

26-
Side effects of writing directly to a component parameter in a setter include infinite rendering loops, unexpected extra renderings, and overwriting parameter changes.
26+
Side effects of writing directly to a component parameter in a setter include infinite rendering loops, unexpected extra renderings, and parameter value overwrites.
2727

2828
## How to fix violations
2929

30-
Implement the component parameter as an auto property and override <xref:Microsoft.AspNetCore.Components.ComponentBase.OnParametersSet%2A> or <xref:Microsoft.AspNetCore.Components.ComponentBase.OnParametersSetAsync%2A> in the component class to modify the parameter's value. For more information, see the [`OnParametersSet{Async}` lifecycle method](xref:blazor/components/lifecycle#after-parameters-are-set-onparameterssetasync).
30+
Implement the component parameter as an auto property and override <xref:Microsoft.AspNetCore.Components.ComponentBase.OnParametersSet%2A> or <xref:Microsoft.AspNetCore.Components.ComponentBase.OnParametersSetAsync%2A> in the component class to transform the parameter's value. For more information, see the [`OnParametersSet{Async}` lifecycle method](xref:blazor/components/lifecycle#after-parameters-are-set-onparameterssetasync).
3131

3232
## When to suppress warnings
3333

0 commit comments

Comments
 (0)