react-firehooks
Version:
Lightweight dependency-free collection of React hooks for Firebase
13 lines (12 loc) • 755 B
TypeScript
import { DataSnapshot, Query } from "firebase/database";
import type { ValueHookResult } from "../common/index.js";
export type UseObjectOnceResult = ValueHookResult<DataSnapshot, Error>;
/**
* Returns and updates the DataSnapshot of the Realtime Database query. Does not update the DataSnapshot once initially fetched
* @param query Realtime Database query
* @returns User, loading state, and error
* - value: DataSnapshot; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export declare function useObjectOnce(query: Query | undefined | null): UseObjectOnceResult;