useKeepSessionAlive hook extends the current session. Call it periodically when the user is active to prevent automatic session expiry.
Hook for extending the current session to prevent automatic logout
useKeepSessionAlive hook extends the current session. Call it periodically when the user is active to prevent automatic session expiry.
import { useKeepSessionAlive } from "@getpara/react-native-wallet";
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;
}