Using the Razor Components

Learn how to call Razor components in other components.

We'll cover the following

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:

  1. Return to Visual Studio.
  2. Open the Pages\Index.razor file.
  3. Delete all of the markup. Be sure you do not remove the @page directive at the top of the file.
  4. Add the following markup below the @page directive:

Get hands-on with 1200+ tech skills courses.