import React, { useEffect } from "react";import { Text, View, StyleSheet, BackHandler, Alert } from "react-native";const App = () => { useEffect(() => { const backAction = () => { Alert.alert("Hold on!", "Are you sure you want to go back?", [ {text: "Cancel", onPress: () => null, style: "cancel"}, { text: "YES", onPress: () => BackHandler.exitApp() } ]); return true; }; const backHandler = BackHandler.addEventListener( "hardwareBackPress", backAction ); return () => backHandler.remove(); }, []); return ( Click Back button! );};const styles = StyleSheet.create({ container: { flex: 1, alignItems: "center", justifyContent: "center"}, text: { fontSize: 18, fontWeight: "bold"}});export default App;