DEV Community

Discussion on: Write better Vue JS code

Collapse
 
mratiebatie profile image
Sjors van Dongen

Nice article, thank you. I think it’s even better to use mapState instead of a getter when the variable is not changed in the getter. Getters are actually provided to adjust a variable before returning it.

Collapse
 
obbap profile image
paschal

True, When there are so many getters and things get verbose, mapState works fine, but mapState actually helps you create computed getter properties under the hood. So you're still using getters. I saw that here, vuex.vuejs.org/guide/state.html