# [Vue.js] Computed property defined within mapState() has no setter Subscribe to RSS

In my Nuxt application I’m initialising computed properties with data retrieved from the store within the mapState helper, however I also need to modify the value of these computed properties upon certain user actions.

Well I can’t do that as I get a “has no setter” error when using that code:

computed: {
…mapState({
monRaw: state => state.currentWeek

I tried to define setters to no avail and the code doesn’t make too much sense either:

computed: {
…mapState({
get: function (state) {
return state.currentWeek
},
set: function (state, data) {
state.currentWeek = data
}

Is it simply not possible to change computed properties’ values when defined with mapState()?

### Solution :

mapState is a convenience function that provides a mapping of a computed property under the identical key in the vuex store. It provides read only access to those properties. Since you want to use updates you will have to forego mapstate and define the own computed getter/setter as follows:

computed: {
currentWeek: {
get() {
return this.$store.state.currentWeek; }, set(v) { this.$store.commit(‘updateCurrentWeek’, v);
}
}

}

obviously updateCurrentWeek will have to be defined in the mutations section of the vuex store.