Vue · Junior · Question 67 of 75

How do you navigate to a route by its name?

router.push({ name: 'user', params: { id: 42 } })

Explanation

Named routes don't break when the URL path changes, and params are encoded automatically.

Further reading

Problem with a question

Vue · Junior · question 67

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz