Search code examples
nuxt.jsvuexvue-apollo

Can I use Nuxt Apollo local state to replace Vuex entirely?


I am building a Nuxt app with a GraphQL API, connected via the nuxt module of Vue Apollo.

I'm currently using Vuex to store app-wide things, and in this one specific case a property called alert. The alert object stored in Vuex tells me what type of alert it is, what its message is, and whether it's active or not.

Since introducing GraphQL to my app though, I was wondering if it's possible to store that type of state data through Vue Apollo instead of Vuex? I read this in the documentation... would this be a better solution than mixing Vuex with Apollo, or is it better to separate state so that app-wide state is handled with Vuex, and API state is handled with Apollo?


Solution

  • Yes, it is better to separate the state so that the app-wide state is handled with Vuex, and the API state is handled with Apollo?

    This will EXTRACT DATA LAYER which will be S.O.L.I.D compatible.