Currently, I am encountering an issue with the code snippet below that is used to insert a new object into the 'items' array. The problem lies in the fact that whenever a new object is added, it ends up replacing the content of the previously added object. As a result, the 'items' array always contains the same objects, despite individual differences of the added objects.
I have come to understand that this behavior is likely caused by using the 'push' method which passes the reference. How can I address this issue within VueJS?
Store.js
var store = new Vuex.Store({
state: {
value: 1,
quote: {
items: [],
something: ''
}
},
mutations: {
ADD (state, item) {
state.quote.items.push(item)
}
}
})