Render fragments can be defined using Razor template syntax. The templated components can be rendered either using a Razor template with an argument or directly.
@page "/razor"
@{
RenderFragment template = @<p>The time is @DateTime.Now.</p>;
RenderFragment<Employee> ItemTemplate = (item) => @<p>Employee name is @item.Name.</p>;
}
@template
@ItemTemplate(emp)
@code {
Employee emp = new Employee { Name = "Test" };
public class Employee
{
public string Name;
}
}
Render fragments can be defined using Razor template syntax. The templated components can be rendered either using a Razor template with an argument or directly.
need an explanation for this answer? contact us directly to get an explanation for this answer