Looking for a solution to replace the content of an object with another in an array of objects without passing the reference directly.
The challenge is not knowing what values my function will pass, so I can't use them as keys to avoid copying the reference. Is there any way to assign the value directly without referencing?
I have attempted two methods:
state.document["attributes"].splice(state.document["attributes"][state.currentIndex], 1, section);
And
state.document["attributes"][state.currentIndex] = section
Where state.document["attributes"]
represents my array and state.currentIndex
indicates the index where I want to perform the replacement.
The issue I'm facing is that my object can be either a table, a paragraph, or some other type.
When the objects are identical, it simply replaces the content :/
Any assistance on this matter would be greatly appreciated. Thank you!