Home > database >  How to put base content in derived component?
How to put base content in derived component?

Time:07-27

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?

CodePudding user response:

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>
  • Related