Skip to content

If a new variable is added after the state is updated and not defined in the state at first, only $state can obtain it #1783

Discussion options

You must be logged in to vote

Yes, this is normal: you have to declare your initial state.

If for some reason, that's not possible to you, you have to manually declare both properties to access it diretly on the store. You can find an example at https://pinia.vuejs.org/core-concepts/plugins.html#adding-new-state.

Note you can also keep your way and only access the property through store.$state if that is fine for you.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@vela666
Comment options

@vela666
Comment options

@posva
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants