Can I do dispatch from getters in Vuex

Getters can not call dispatch as they are passed the state not context of the store

Actions can call state, dispatch, commit as they are passed the context.

Getters are used to manage a ‘derived state’.

If you instead set up the pets state on the components that require it then you would just call FETCH_PETS from the root of your app and remove the need for the getter

Leave a Comment