How does one resolve this Blazor Server error?
EditForm requires either a Model parameter, or an EditContext parameter
I have created a minimally reproducible example below. The issue seems to be because the model is not instantiated...Why does the following simple page throw this error?
@page "/"
<EditForm @Model="@person">
<input @bind="@person.FirstName" />
<input @bind="@person.LastName" />
</EditForm>
@code
{
public Person person = new Person();
protected override Task OnInitializedAsync()
{
person = new Person
{
FirstName = "Fred",
LastName = "Flintstone"
};
return base.OnInitializedAsync();
}
}