> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: Watch<T>

> A watch on the output of a Bijection query function.

[react](/api/modules/react).Watch

A watch on the output of a Bijection query function.

## Type parameters

| Name |
| :- |
| `T` |

## Methods

### onUpdate

▸ **onUpdate**(`callback`): () => `void`

Initiate a watch on the output of a query.

This will subscribe to this query and call
the callback whenever the query result changes.

**Important: If the client is already subscribed to this query with the
same arguments this callback will not be invoked until the query result is
updated.** To get the current, local result call
[localQueryResult](/api/interfaces/react.Watch#localqueryresult).

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `callback` | () => `void` | Function that is called whenever the query result changes. |

#### Returns

`fn`

* A function that disposes of the subscription.

▸ (): `void`

Initiate a watch on the output of a query.

This will subscribe to this query and call
the callback whenever the query result changes.

**Important: If the client is already subscribed to this query with the
same arguments this callback will not be invoked until the query result is
updated.** To get the current, local result call
[localQueryResult](/api/interfaces/react.Watch#localqueryresult).

##### Returns

`void`

* A function that disposes of the subscription.

***

### localQueryResult

▸ **localQueryResult**(): `undefined` | `T`

Get the current result of a query.

This will only return a result if we're already subscribed to the query
and have received a result from the server or the query value has been set
optimistically.

**`Throws`**

An error if the query encountered an error on the server.

#### Returns

`undefined` | `T`

The result of the query or `undefined` if it isn't known.

***

### journal

▸ **journal**(): `undefined` | [`QueryJournal`](/api/modules/browser#queryjournal)

Get the current [QueryJournal](/api/modules/browser#queryjournal) for this query.

If we have not yet received a result for this query, this will be `undefined`.

#### Returns

`undefined` | [`QueryJournal`](/api/modules/browser#queryjournal)
