I think that what he/she means is that that both spreader and obj.assign do level 1 clone. So if the object to be cloned contains other objects they will be cloned by ref or shallow copy. So later if you want to change that nested objects like:
myClonedObj.myNestedObj.somePropertyOfTheNestedObj = someNewVal;
then all other object nesting that object will have it changed.
Comment hidden by post author
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
People confuse that spreader do a deeply nested copy. Need to be aware that both spreader and obj.assign doesn't do nested deep copy.
Could you share the detail of this?
I think that what he/she means is that that both spreader and obj.assign do level 1 clone. So if the object to be cloned contains other objects they will be cloned by ref or shallow copy. So later if you want to change that nested objects like:
myClonedObj.myNestedObj.somePropertyOfTheNestedObj = someNewVal;
then all other object nesting that object will have it changed.