0👍
✅
You are mutating a reference value, it doesn’t matter which one you change – they both get updated as they share the same address in memory heap.
So Use ES6 spread
to make clone when you are trying to have copy of any reference value.
this.user = { ...this.tuser }
or
this.tuser = { ...this.user }
References : spread_es6
0👍
It is most likely because you reference one object to another.
As objects are reference not primitive values.
What it means is:
if you make obj1 = obj2, then actually they both point to the same object, if you change one, another change also.
You need to use something like Object.assign()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
0👍
Source:stackexchange.com