thi.setstate with apaend state array typescript code example
Example 1: react native update state array of objects
let markers = [ ...this.state.markers ];
markers[index] = {...markers[index], key: value};
this.setState({ markers });
Example 2: push values to state array class react
this.setState(prevState => ({
arrayvar: [...prevState.arrayvar, newelement]
}))