[Vuejs]-How to map state back to component in Vue.js AWS Amplify auth page

1👍

The mapState helper is just sugar syntax for not repeating multiple times the whole this.$store.state.foo piece of code.

You can certainly use mapState like this

import { mapState } from 'vuex'

computed: mapState([
  // map this.signedIn to this.$store.state.signedIn
  'signedIn'
])

Or like this if you want to also use local properties besides the ones of mapState

import { mapState } from 'vuex'

computed: 
   localComputed () { /* ... */ },
   ...mapState([
   // map this.signedIn to this.$store.state.signedIn
     'signedIn'
   ])

Here are the docs for more information on this.

Leave a comment