When working with vuex, I often come across a scenario where I receive an object like the following:
user: {name: 'test'}
In my app.vue file, I access this object using this.$store.getters.user
computed: {
user: function() {
let user = this.$store.getters.user
return user
}
}
I also need to set a data property called 'this.name'
data() {
return {
name: ''
}
}
computed: {
user: function() {
let user = this.$store.getters.user
this.name = user.name
return user
}
}
However, when linting, I encounter the error 'unexpected side effect in computed property'. The 'name' data should ideally be used as a v-model for updating API parameters. While I understand that it can be ignored if you are aware of what you're doing, I am curious as to why this error is triggered and how to handle it effectively.