I have an Arrow function inside my Class in react app specific and i want to call this function after pressed to Button so there is two way i don't understand differant between them
Code
selectPhotoTapped = () => {
ImagePicker.showImagePicker(options, response => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled photo picker');
} else {
let source = {uri: response.uri};
this.setState({
avatarSource: source,
});
}
});
};
// First One
<TouchableOpacity onPress={this.selectPhotoTapped}>
<Text>Upload</Text>
</TouchableOpacity>
// Second One
<TouchableOpacity onPress={ () => this.selectPhotoTapped()}>
<Text>Upload</Text>
</TouchableOpacity>