TanStackT
TanStackโ€ข3y agoโ€ข
8 replies
living-lavender

How to assign useQuery's "data" to a Pinia composition store Ref?

Hi,
I'm trying to use vue-query with Pinia in order to share data across my app, but still make use of vue-query's great features, such as providing all the different states of fetching and refetching automatically. However, I am not sure if this is an anti-pattern.
In this snippet, "expeses.value" would be of type ObjectRefImp instead of Array which creates some unexepcted results. For example in the "pop()" function I get an Error taht pop is not a method of express.value.

Is there a correct approach to this...? ๐Ÿ‘€

Thanks!
Screenshot_2023-04-12_at_17.38.58.png
Was this page helpful?