Vue Router

Vue Router allows you to create single-page applications with dynamic navigation.

Snippet:

const routes = [{ path: "/", component: Home }, { path: "/about", component: About }]; const router = VueRouter.createRouter({ history: VueRouter.createWebHistory(), routes }); const app = Vue.createApp({}); app.use(router).mount("#app");

Example:

<router-link to="/">Home</router-link><router-link to="/about">About</router-link><router-view></router-view>