Changing the layout
If we want to have a specific layout for a page (not the default one specified in the app.razor file), we can use the @layout directive:
@layout AnotherLayoutFile
This way, our component will use the layout file specified (this only works for components that have the @page directive).
Setting a namespace
By default, the namespace of the component will be the name of the default namespace of our project, plus the folder structure. If we want our component to be in a specific namespace, we can use the following:
@namespace Another.NameSpace
Setting a route
We have already touched on the @page directive. If we want our component to be directly accessed using a URL, we can use the @page directive:
@page "/theurl"
The URL can contain parameters, subfolders, and much more, which we will come back to later in this chapter.
Adding a using statement
To add a namespace to our component, we can use the @using directive:
@using System.IO
If there are...