Function useQueries

  • Returns and updates a QuerySnapshot of multiple Firestore queries

    Type Parameters

    • AppModelTypes extends readonly unknown[] = readonly DocumentData[]

      Tuple of shapes of the data after it was converted from firestore

    • DbModelTypes extends readonly DocumentData[] = readonly DocumentData[]

      Tuple of shapes of the data in firestore

    Parameters

    • queries: {
          [Index in string | number | symbol]: Query<AppModelTypes[Index<Index>], DbModelTypes[number]>
      }

      Firestore queries that will be subscribed to

    • Optionaloptions: UseQueriesOptions

      Options to configure the subscription

    Returns UseQueriesResult<AppModelTypes>

    Array with tuple for each query:

    • value: QuerySnapshot; undefined if query is currently being fetched, or an error occurred
    • loading: true while fetching the query; false if the query was fetched successfully or an error occurred
    • error: undefined if no error occurred