Function useDocument

  • Returns and updates a DocumentSnapshot of a Firestore DocumentReference

    Type Parameters

    • AppModelType = DocumentData

      Shape of the data after it was converted from firestore

    • DbModelType extends DocumentData = DocumentData

      Shape of the data in firestore

    Parameters

    Returns UseDocumentResult<AppModelType>

    Document snapshot, loading state, and error

    • value: DocumentSnapshot; undefined if document does not exist, is currently being fetched, or an error occurred
    • loading: true while fetching the document; false if the document was fetched successfully or an error occurred
    • error: undefined if no error occurred