I am trying to set state to particular index of array.
   let updatedArray = [...this.state.AnswerState];
   updatedArray[name] = value;
   this.setState({
        AnswerState: [updatedArray]
   }, () => {
        console.log(this.state.AnswerState);
   });
I have
this.state.AnswerState = [ 
                           0: {Name: ""}
                           1: {Number: ""}
                         ]
which is dynamically generated. How should I update the state? I am getting output as nested loops:
0: Array(1)
 0: {Name: ""}
    Name: "s"
 Name: "ss"
and so on..
I want that my state should update on accepting input as below:
AnswerState = [
    Name: aaa, Number: bbbb
]
 
    