Menu
CoddyTech

Named Destinations

Part of the Routing and State section of Coddy's Vue journey. Lesson 4 of 55.

A route name identifies a record independently of its path. This record uses the path /reading-room but the name reading. A named location lets the router generate the matching href.

{ path: '/reading-room', name: 'reading', component: Reading }
// Template: <RouterLink :to="{ name: 'reading' }">Read</RouterLink>

Keep route names unique in one router. A named destination is an object, so bind it with :to. The name is not automatically treated as a path string: to="reading" and :to="{ name: 'reading' }" express different requests.

challenge icon

Challenge

Medium

The calendar route lives at /calendar but is named events. Create a#agenda using the named destination { name: 'events' }, and a#support using the name help. Keep the route names unique and show the corresponding supplied views.

Keep the supplied route readout and bootstrap files.

Try it yourself

<!doctype html><html><head><meta charset="UTF-8"><title>Routing practice</title></head><body><div id="app"></div><script type="module" src="./main.js"></script></body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Routing and State