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 { useReset } from '@journium/nextjs';

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

  const handleLogout = async () => {
    await logoutUser();
    reset();
    router.push('/');
  };

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

Last updated on

On this page