I am searching a solution where I can replace a object content with other in a array of objects.
The thing is, I don't know what my function will pass, so I can't pass the values inside as keys directly, so the reference won't be copied, is there any way I can assign the value directly without passing the reference? I know that objects pass references and not values, but is there a way to do that?
I tried two ways:
state.document["atributes"].splice(state.document["atributes"][state.currentIndex],1,section);
And
state.document["atributes"][state.currentIndex] = section
Where my state.document["atributs"]
is my array, and the state.currentIndex
the index where I want to replace the element inside my array.
What happens at the moment is that my object can be a Table a paragraph etc.
If the objects are the same it replaces the content :/
Any help with this? Thank you