How to put base content in derived component?

I have base component with basic html content and derived component which adds decorations to it. But now I realized I don’t know how to make blazor put base content within derived component. I am looking in my case for something like this:

<div>
<span>my derived decoration</span>
@base_content
</div>

How to tell Blazor to put "here" the base content?

>Solution :

In your derived components .razor file include a call to base.BuildRenderTree(__builder) .

An example:

@inherits YourBaseComponent

<div>
<span>my derived decoration</span>

@{
    base.BuildRenderTree(__builder);
}

</div>

Leave a Reply