Skip to content

react-query-firebase / useDocReferences

Function: useDocReferences() ​

ts
function useDocReferences<AppModelType>(options): (DocumentReference<AppModelType, AppModelType> | null)[];

Defined in: src/web/firestore/useDocReferences.ts:32

Gets CollectionReference instances

Type Parameters ​

AppModelType ​

AppModelType extends AppModel = AppModel

Parameters ​

options ​

Options

references ​

Omit<{ db: Firestore; path?: string; pathSegments?: string[]; reference?: | CollectionReference<AppModelType, AppModelType> | DocumentReference<AppModelType, AppModelType>; }, "db">[]

Returns ​

(DocumentReference<AppModelType, AppModelType> | null)[]

A reference to a Firestore document

Example ​

jsx
export const MyComponent = () => {
 const ref = useDocReference({
     reference: collection('todos')
     path: 'first'
 });
};

Released under the MIT License.