Skip to content

Using vue query with Pinia or Vuex #173

Answered by DamianOsipiuk
marina-mosti asked this question in Q&A
Discussion options

You must be logged in to vote

tl;dr Yes, vue-query should be used as a standalone solution for a server-cache.

I would distinguish 3 types of state in apps currently:

  • local state
  • global state (lang, global user settings etc.)
  • server state (thing that are out of you app control) - this lol

Vue-query compostables should ideally be stored in file outside of the component. Then in any component that needs some server state just use the hook. Requests would be automatically deduplicated and state would be automatically shared between all components that are interested in it.
There is no need to use vuex or pinia with it as it does not give you any benefit. Just additional boilerplate.

You can still use pinia or vuex for …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@marina-mosti
Comment options

Answer selected by marina-mosti
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants