Mirrors the functionality of Apollo client's useQuery hook, but with a "query" being any async function rather than GQL statement.
npm i use-async-queryimport firestore from '@firebase/firestore'
import { useQuery } from 'use-async-query'
import { Loading, Error, Results } from './components'
const myQuery = (variables) => firestore()
.collection('myCollection')
.where('example', '==', variables.example)
.get()
const MyComponent = () => {
const {loading, error, data} = useQuery(myQuery, { variables: { example: 'test' }})
return <>
{loading && <Loading />}
{error && <Error error={error} />}
{data && <Results data={data}>}
</>
}