Using the Razor Components
Learn how to call Razor components in other components.
Razor components are used by including them in the markup of another component. We will add a Counter
component to the “Home” page. We do this as follows:
- Return to Visual Studio.
- Open the
Pages\Index.razor
file. - Delete all of the markup. Be sure you do not remove the
@page
directive at the top of the file. - Add the following markup below the
@page
directive:
Get hands-on with 1400+ tech skills courses.