I don’t really agree with the point about not using mapState (and etc.).
Krystian Fras
11

Hi. My problem is not in how to call the helpers. It’s more that when the computed props and the methods have been created by the helpers, namespaced or not, you will have in your code things like this.myGetter or this.myMutation(), and in components with a big <script>part, such store calls do not stand out from inner computed props or methods, and it can be very confusing.

More, in some cases, you cannot know if a call is a mutation or an action because actions don’t need Promise treatment at any time.

On the other hand, a call like this.$store.dispatch(‘user/delete', user.id)is completely explicit: it shows it’s calling something in the store, that it’s an action (dispatch), from the user module, even if you don’ have the mapActions spread operator under the eyes at this time.

I used the vuex helpers massively and exclusively by the past, and if I changed my point of view, it’s the consequence of 2 years of usage in big teams. It has led in a lot of errors and bugs…

Best regards