react-firehooks
Version:
Lightweight dependency-free collection of React hooks for Firebase
13 lines (12 loc) • 642 B
TypeScript
import { Auth, AuthError, User } from "firebase/auth";
import { ValueHookResult } from "../common/index.js";
export type UseAuthStateResult = ValueHookResult<User | null, AuthError>;
/**
* Returns and updates the currently authenticated user
* @param auth Firebase Auth instance
* @returns User, loading state, and error
* - value: User; `undefined` if user is currently being fetched, or an error occurred
* - loading: `true` while fetching the user; `false` if the user was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export declare function useAuthState(auth: Auth): UseAuthStateResult;