import { ... } from 'react-firehooks/database';
Returns and updates the DataSnapshot of the Realtime Database query
const [dataSnap, loading, error] = useObject(query);
Params:
query
: Realtime Database query
Returns:
value
: DataSnapshot;undefined
if query is currently being fetched, or an error occurredloading
:true
while fetching the query;false
if the query was fetched successfully or an error occurrederror
:undefined
if no error occurred
Returns the DataSnapshot of the Realtime Database query. Does not update the DataSnapshot once initially fetched
const [dataSnap, loading, error] = useObjectOnce(query);
Params:
query
: Realtime Database query
Returns:
value
: DataSnapshot;undefined
if query is currently being fetched, or an error occurredloading
:true
while fetching the query;false
if the query was fetched successfully or an error occurrederror
:undefined
if no error occurred
Returns and updates the DataSnapshot of the Realtime Database query
const [objectValue, loading, error] = useObjectValue(query, options);
Params:
query
: Realtime Database queryoptions
: Options to configure how the object is fetchedconverter
: Function to extract the desired data from the DataSnapshot. Similar to Firestore converters. Default:snap.val()
.
Returns:
value
: Object value;undefined
if query is currently being fetched, or an error occurredloading
:true
while fetching the query;false
if the query was fetched successfully or an error occurrederror
:undefined
if no error occurred
Returns the DataSnapshot of the Realtime Database query. Does not update the DataSnapshot once initially fetched
const [objectValue, loading, error] = useObjectValueOnce(query, options);
Params:
query
: Realtime Database queryoptions
: Options to configure how the object is fetchedconverter
: Function to extract the desired data from the DataSnapshot. Similar to Firestore converters. Default:snap.val()
.
Returns:
value
: Object value;undefined
if query is currently being fetched, or an error occurredloading
:true
while fetching the query;false
if the query was fetched successfully or an error occurrederror
:undefined
if no error occurred