useReset()

Use the useReset() hook to reset user identity when they log out or when you want to clear the user's identity.

Reset user identity

The useReset() hook is used to reset user identity when they log out or when you want to clear the user's identity.

pages/logout.tsx
import React from 'react';
import { useReset } from '@journium/react';

function LogoutButton() {
  const reset = useReset();

  const handleLogout = async () => {
    await logoutUser();
    reset();
  };

  return <button onClick={handleLogout}>Log Out</button>;
}

Last updated on

On this page