The router-view Element
The router-view
element is a functional component in which the app routing system loads the matched and up-to-date view content of any given URL path received from the user.
In short, router-view
is a Vue component whose job is to do the following:
- Render different child components
- Mount and unmount itself automatically at any nesting level, depending on the route's given path
Without router-view
, it is almost impossible to have dynamic content rendered correctly for users at runtime. For example, when a user navigates to the Home
page, router-view
knows and renders the content related to that page only.
In the next section, we will see how we can set the entry point (default route) of an application by passing it a prop.