react-query-firebase / react-native/firestore / useCollectionReference
Function: useCollectionReference()
ts
function useCollectionReference<AppModelType>(options): CollectionReference<AppModelType>;Defined in: react-native/firestore/useCollectionReference.ts:46
Gets a CollectionReference instance that refers to a subcollection of reference at the specified relative path.
Type Parameters
AppModelType
AppModelType extends AppModel = AppModel
Parameters
options
Options
path
string
A slash-separated path to a collection.
pathSegments?
string[]
Additional path segments that will be applied relative
reference?
| CollectionReference<AppModelType> | DocumentReference<AppModelType>
CollectionReference or DocumentReference that is used as a root to lookup a sub-collection
Returns
CollectionReference<AppModelType>
A reference to a Firestore collection
Example
jsx
export const MyComponent = () => {
const ref = useCollectionReference({
path: 'todos'
});
};