Fügen Sie das Neue Array im hinteren Teil des React -Zustands hinzu
this.setState(prevState => ({
myArray: [...prevState.myArray, "new value"]
}))
Worrisome Weevil
this.setState(prevState => ({
myArray: [...prevState.myArray, "new value"]
}))
this.setState({ myArray: [...this.state.myArray, 'new value'] }) //simple value
this.setState({ myArray: [...this.state.myArray, ...[1,2,3] ] }) //another array
this.setState(prevState => ({
myArray: [...prevState.myArray, {"name": "object"}]
}))