This code will help you to understand how to dynamically create a component.
The RenderFragment is used to create a component dynamically.
@page "/" @CreateDynamicComponent(); @code { RenderFragment CreateDynamicComponent() => builder => { builder.OpenComponent(0, typeof(SurveyPrompt)); builder.AddAttribute(1, "Title", "Some title"); builder.CloseComponent(); }; }
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
The RenderFragment is used to create a component dynamically.
need an explanation for this answer? contact us directly to get an explanation for this answer