Closed
Description
For example, if you have a component that is linked to a sub-property, it is better to set default values for all linked properties, instead of testing the initial variable.
// DON'T USE
@if (MyData != null)
{
<input type="text" value="MyData.Firstname">
}
// PREFERS
<input type="text" value="MyData.Firstname">
@code
{
MyData MyData { get; set; } = new MyData();
}
This allows Blazor to send the HTML code to the client who can display it.
Then Blazor, via SignalR, will update the content of the component that is already drawn.
Otherwise, an empty page is displayed to the user, while the whole component is known...
which is not ergonomically pleasant for the user.