I'm using the following code to insert a new object into the array 'items'. But the problem is when I insert a new object, it replaces the content of the object that is added just before. In such way, the always contains the same objects, even though added objects are different.
I heard it's due to using 'push' which also passes the reference. How can I fix this is VueJS
Store.js
var store = new Vuex.Store({
state: {
value: 1,
quote: {
items: [],
something: ''
}
},
mutations: {
ADD (state, item) {
state.quote.items.push(item)
}
}
})