Inherits from LayoutComponentBase, which adds the Body property to the layout.
Uses the Razor syntax @Body in the markup where the content should need to be rendered.
The default template of Blazor contains MainLayout.cshtml under the shared folder. It works as a layout page.ecuted when the rendering of all the references to the component is populated.
Technically, a layout is just another component.
To convert a component into a layout:
The default template of Blazor contains MainLayout.cshtml under the shared folder. It works as a layout page.ecuted when the rendering of all the references to the component is populated.
Use layout in component
The layout can be defined by using both @layout directive and Layout Attribute in a component.
Using @layout directive
Define Layout globally
The layout can be defined globally for all components. So that there is no need to add them to each page.
In _import.cshtml file, import the MainLayout.
I would suggest you check the below link for better understanding:
need an explanation for this answer? contact us directly to get an explanation for this answerhttps://www.c-sharpcorner.com/article/working-with-layout-page-in-blazor/