In my Vue.js project integrated with Vuex, I am using Typescript syntax. While trying to use the mapState method as computed in my .ts file, I encountered a syntax error. Currently, I am following the suggested syntax for computed function in the documentation:
get counter() {
return this.$store.state.count;
}
However, it is mentioned in the Vuex docs that using mapState instead of the above method is more efficient and less repetitive, especially in large applications. I attempted to use mapState in my Typescript component but failed to do so. Here are some unsuccessful attempts:
get mapState({
counter:count
});
// or
get mapState(['name', 'age', 'job'])
If anyone could provide assistance on the correct way to use mapState in Typescript components, I would greatly appreciate it.