Skip to content

How to use storage globally? #927

Closed Answered by soc221b
allsilaevex asked this question in Help and Questions
Discussion options

You must be logged in to vote

The state will be shared globally 🤔.

https://pinia.vuejs.org/introduction.html#why-should-i-use-pinia :

Pinia is a store library for Vue, it allows you to share a state across components/pages. If you are familiar with the Composition API, you might be thinking you can already share a global state with a simple export const state = reactive({}).

src/component/Foo.vue

<script setup lang="ts">
import { useStore } from '@/app/stores/global';

const store = useStore(); // this store is the same as the store in `Bar.vue`
</script>

src/component/Bar.vue

<script setup lang="ts">
import { useStore } from '@/app/stores/global';

const store = useStore(); // this store is the same as the store in…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by posva
Comment options

You must be logged in to vote
5 replies
@TheOrgPlanDev
Comment options

@projct1
Comment options

@Jas-n
Comment options

@soc221b
Comment options

@IceflowRE
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants