add element to array use state react code example
Example 1: React Hooks append state
setTheArray(currentArray => [...currentArray, newElement])
Example 2: add new array at the back of react state
this.setState(prevState => ({
myArray: [ {"name": "object"}, ...prevState.myArray]
}))