Firebase Hooksv0.2.0

useLogout

Sign-out, with your server session cleared first.

onBeforeSignOut runs before Firebase clears anything. If it throws, the Firebase session is left intact and the user can retry.

const { logout, loading } = useLogout({ onBeforeSignOut: clearSession });

<button onClick={logout} disabled={loading}>
  Sign out
</button>;

Returns

logout() resolves to { success: true } or a failure result. Also exposes loading and error.

Options

Prop

Type

On this page