[Vuejs]-How does pinia (Vue.js) determines the correct pinia instance to use

0👍

When you use the app.use() method to install a plugin in Vue, that plugin scope becomes the installed Vue instance’s scope. useFooStore() will have access to the correct instance of Pinia because it is called within the context.

In the situation described, it would not be possible for a component on one Vue instance to access the stores from a different instance of Pinia, they are isolated (context-bounded). Vue does not have a global singleton instance, so if you want to use multiple instances of Vue in the same app, you will have to create/manage those by yourself.

Leave a comment