Basic Routing
This code defines two routes: the home route and the user route. The home route is located at the root path (/
) and the user route is located at the /users/:name
path. The :name
parameter will be passed to the UserComponent
component as a prop.To use the routes, you can use the router.navigate()
method. For example, the following code will navigate to the user page for the user with the name "John Doe"
:
This code defines two routes: the home route and the user route. The home route is located at the root path (/
) and the user route is located at the /users/:name
path. The :name
parameter will be passed to the UserComponent
component as a prop.
To use the routes, you can use the router.navigate()
method. For example, the following code will navigate to the user page for the user with the name "John Doe"
:
This code will navigate to the /users/John Doe
path, which will render the UserComponent
component with the name
prop set to "John Doe"
.