how to update state of array in react by pushing values code example
Example: push values to state array class react
this.setState(prevState => ({
arrayvar: [...prevState.arrayvar, newelement]
}))
this.setState(prevState => ({
arrayvar: [...prevState.arrayvar, newelement]
}))