Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getpara.com/llms.txt

Use this file to discover all available pages before exploring further.

The useLogout hook logs out the current user and clears their session. Optionally clears any pregenerated wallets stored for the user.

Import

import { useLogout } from "@getpara/react-native-wallet";

Usage

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} />;
}