Skip to content

react-query-firebase / react-native/firestore / useDocReference

Function: useDocReference()

ts
function useDocReference<AppModelType>(options): null | DocumentReference<AppModelType>;

Defined in: react-native/firestore/useDocReference.ts:35

Gets a CollectionReference instance.

Type Parameters

AppModelType

AppModelType extends AppModel = AppModel

Parameters

options

Options

path?

string

pathSegments?

string[]

reference?

| CollectionReference<AppModelType> | DocumentReference<AppModelType>

Returns

null | DocumentReference<AppModelType>

A reference to a Firestore document

Example

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

Released under the MIT License.