MCPcopy Index your code
hub / github.com/CSFrequency/react-firebase-hooks / useDocumentData

Function useDocumentData

firestore/useDocument.ts:111–124  ·  view source on GitHub ↗
(
  docRef?: DocumentReference<T> | null,
  options?: DataOptions<T> & InitialValueOptions<T>
)

Source from the content-addressed store, hash-verified

109};
110
111export const useDocumentData = <T = DocumentData>(
112 docRef?: DocumentReference<T> | null,
113 options?: DataOptions<T> & InitialValueOptions<T>
114): DocumentDataHook<T> => {
115 const [snapshot, loading, error] = useDocument<T>(docRef, options);
116
117 const value = getValueFromSnapshot(
118 snapshot,
119 options?.snapshotOptions,
120 options?.initialValue
121 );
122
123 return [value, loading, error, snapshot];
124};
125
126export const useDocumentDataOnce = <T = DocumentData>(
127 docRef?: DocumentReference<T> | null,

Callers

nothing calls this directly

Calls 2

useDocumentFunction · 0.85
getValueFromSnapshotFunction · 0.85

Tested by

no test coverage detected