useIsSupportedQuery
Check whether Firebase Analytics is supported in the current environment.
Usage
import {
analyticsQueryKeys,
useIsSupportedQuery,
} from "@tanstack-query-firebase/react/analytics";
const { data: supported, isLoading } = useIsSupportedQuery({
queryKey: analyticsQueryKeys.isSupported(),
staleTime: Number.POSITIVE_INFINITY,
});
if (supported) {
// Safe to call getAnalytics()
}
Notes
- Wraps Firebase
isSupported. - Does not accept an
Analyticsinstance. - Requires a caller-provided
queryKey.