Skip to main content
The useKeepSessionAlive hook extends the current session. Call it periodically when the user is active to prevent automatic session expiry.

Import

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

Usage

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

function SessionKeepAlive() {
  const { keepSessionAliveAsync } = useKeepSessionAlive();

  useEffect(() => {
    const interval = setInterval(() => {
      keepSessionAliveAsync().catch(console.error);
    }, 5 * 60 * 1000); // every 5 minutes

    return () => clearInterval(interval);
  }, [keepSessionAliveAsync]);

  return null;
}