[Vuejs]-Why does the Vuex state variable seem to be bound to a component's local variable?

0👍

enter image description here

Thank you @Steven B. for the help! I spent a long time on this and that helped me greatly. Above is where I created a separate object to bring into the commit mutation. This, I would assume, kept the data from being bound to both the component object and the state object.

I’m unsure as to why creating a new object didn’t work, but assigning the course object to an empty object did the trick.

Edit: as this question/answer seems to have been about objects in javascript, here is a link explaining the topic in detail.

https://scotch.io/bar-talk/copying-objects-in-javascript

Leave a comment