Q:

How do you dynamically create a component?

0

This code will help you to understand how to dynamically create a component.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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();
     };
 } 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now