Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 396 Bytes

File metadata and controls

18 lines (14 loc) · 396 Bytes
title useGetQuery

Read data once from a Realtime Database location.

Usage

import { ref } from "firebase/database";
import { useGetQuery } from "@tanstack-query-firebase/react/database";

const userRef = ref(database, `users/${uid}`);
const { data: snapshot, isLoading } = useGetQuery(userRef, {
  queryKey: ["database", "users", uid],
});
const value = snapshot?.val();