Answer the question
In order to leave comments, you need to log in
How to properly join Object?
There are two objects that need to be combined into one.
(string)=>{
var subDocString = that.state.subDocString;
var assignSubDocString = {subDocString, string};
//записали в новую переменную старое или пустое значение,
// создали новый обьект и записали оба
that.setState({ subDocString: assignSubDocString});
}
assignSubDocString == {"subDocString":{"stack": ....}, "string":{"stack": ....}}
assignSubDocString == {{"stack": ....}, {"stack": ....}}
Answer the question
In order to leave comments, you need to log in
And so you will not succeed, the elements of the object require a key. Use arrays [{},{}]
Come on like this
var assignSubDocString = Object.assign(subDocString, string);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question