Menu
CoddyTech

Router Links

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

Use RouterLink for navigation managed by Vue Router. This link renders an anchor whose destination is /maps; clicking it asks the router to select that location without a full-page reload.

<RouterLink to="/maps">View maps</RouterLink>
<RouterView />

A string to is a path. A bound :to can read a reactive value, so a changing destination also updates the rendered href. A plain anchor is useful for external documents, but it does not provide the same client-router navigation behavior.

challenge icon

Challenge

Medium

Complete the three navigation controls using RouterLink: #home targets /, #events targets /events, and #help targets /help. Each control must render an anchor with the matching href. Preserve the supplied shell note while switching routes.

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