Skip to content

Script setup syntax and pinia reactivity #1962

Discussion options

You must be logged in to vote

In the above example, would a change to any property within the store, say useMyStore.anotherProp cause the above example to re-render, even though it is only using at useMyStore.someProp?

No. The idea in Vue is not to worry about when things render, just let Vue handle that for you.

Is it better to use const { someProp } = storeToRefs(useMyStore) in this case?

Both are fine, use storeToRefs() when having an individual value is more convenient or when you need to pass a piece of state to a Composable

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brandonburkett
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