My problem is, im trying to make my mapView so everytime I tap on it a marker is created and the marker's latitude and longitude are sent to the console in order to send them using fetch, I found something similar here but it's made in a class and im trying to make it out of fucntion element.
Heres the code:
constructor(props) { super(props) this.state = { region: { latitude: 24.92009056750823, longitude: 67.1012272143364, latitudeDelta: 0.1, longitudeDelta: 0.1 }, markers: [] }}<MapView style={styles.map} region={this.state.region}onPress={(e) => this.setState({ markers: [...this.state.markers, { latlng: e.nativeEvent.coordinate }] })}>{ this.state.markers.map((marker, i) => (<MapView.Marker key={i} coordinate={marker.latlng} /> ))}</MapView>