[Vuejs]-Vue Router: How to pass data to component being linked to?

0👍

State management is the keyword, which might help for your further research.
Especially vuex, as the most popular Vue state management library probably makes sense in your case (https://www.npmjs.com/package/vuex). There are tons of tutorials out there.

If you don’t want to use a state management library, you can implement a simple version of it on your own by saving the data in the localstorage or in the cookies. Or – if it’s just about the age, you also could add it to the query params.

There is also a pretty well described SO answer for a similar question: Vue: shared data between different pages

0👍

This is not the best way to do it.

You could implement /edit/:name/:age. But what happens if you access the URL /edit/Carl/999?

You should fetch the data, such as name and age, by a unique user id instead: edit/:userid.

Leave a comment