---
title: useOnValueQuery
---
> ## Documentation Index
> Fetch the complete documentation index at: https://react-query-firebase.invertase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

Subscribe to value events at a Realtime Database location.

## Usage

```tsx
import { ref } from "firebase/database";
import { useOnValueQuery } from "@tanstack-query-firebase/react/database";

const userRef = ref(database, `users/${uid}`);
const { data: snapshot } = useOnValueQuery(userRef, {
  queryKey: ["database", "onValue", "users", uid],
});
```
