0
0
Vueframework~5 mins

RouterLink for navigation in Vue - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is <RouterLink> used for in Vue?
<RouterLink> is a special component in Vue Router that creates clickable links to navigate between pages without reloading the whole app.
Click to reveal answer
beginner
How do you specify the target route in <RouterLink>?
You use the to attribute with a string path or an object describing the route to tell <RouterLink> where to go.
Click to reveal answer
beginner
What happens when you click a <RouterLink> in a Vue app?
Clicking a <RouterLink> changes the URL and shows the new page component without reloading the browser, making navigation fast and smooth.
Click to reveal answer
intermediate
How can you style an active <RouterLink>?
Vue Router adds a CSS class like <code>router-link-active</code> to the active link, so you can style it differently with CSS.
Click to reveal answer
intermediate
Can <RouterLink> be used with dynamic route parameters?
Yes! You can pass an object to to with name and params to navigate to routes with dynamic parts.
Click to reveal answer
What attribute do you use to set the destination in <RouterLink>?
Alink
Bhref
Cto
Dtarget
What does <RouterLink> do differently than a normal <a> tag?
AReloads the whole page
BNavigates without reloading the page
COpens a new browser tab
DDoes nothing
How can you style the currently active <RouterLink>?
AYou cannot style it
BUsing the <code>active</code> attribute
CUsing inline styles only
DUsing the <code>router-link-active</code> CSS class
Which of these is a valid way to use <RouterLink>?
A<RouterLink to="/home">Home</RouterLink>
B<RouterLink href="/home">Home</RouterLink>
C<RouterLink link="/home">Home</RouterLink>
D<RouterLink target="/home">Home</RouterLink>
How do you pass parameters to a dynamic route with <RouterLink>?
AUse <code>:to="{ name: 'user', params: { id: 123 } }"</code>
BUse <code>to="/user/:id"</code>
CUse <code>href="/user/123"</code>
DUse <code>params="id=123"</code>
Explain how helps with navigation in a Vue app.
Think about how clicking a link changes the page smoothly.
You got /5 concepts.
    Describe how to use with dynamic route parameters.
    Focus on how to tell Vue Router which dynamic page to show.
    You got /4 concepts.