Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Does Blazor support passing directly components as generic arguments?

$
0
0

Either I am missing something or this documentation falls short: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/generic-type-support?view=aspnetcore-8.0 All examples are about passing data, while I am interested in passing (directly) a component.

Say I have MyComponent and generic container MyContainer<TComponent>. Within the container .razor page I would like to write:

  @typeparam TComponent where TComponent : ComponentBase  ...<h1>This is my component</h1><TComponent></TComponent>

with such code I am getting error "Found markup element with unexpected name TComponent".

Remark: directly means not using DynamicComponent.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>