You’re viewing the 2.0 (LTS) docs. View the current 3.0 version of this page.
useLogout hook logs out the current user and clears their session. Optionally clears any pregenerated wallets stored for the user.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Hook for logging out the current user
useLogout hook logs out the current user and clears their session. Optionally clears any pregenerated wallets stored for the user.
import { useLogout } from "@getpara/react-native-wallet";
import { useLogout } from "@getpara/react-native-wallet";
import { Alert, Button } from "react-native";
function LogoutButton() {
const { logoutAsync, isPending } = useLogout();
const handleLogout = () => {
Alert.alert("Sign Out", "Are you sure you want to sign out?", [
{ text: "Cancel", style: "cancel" },
{
text: "Sign Out",
style: "destructive",
onPress: async () => {
try {
await logoutAsync({});
} catch (err) {
console.error(err);
}
},
},
]);
};
return <Button title={isPending ? "Signing out..." : "Sign Out"} onPress={handleLogout} disabled={isPending} />;
}