Function: useQuery()
useQuery<
IS,CTX,OS>(config):Query<IS,OS,CTX>
Defined in: react/hooks.ts:389
Creates a new query or retrieves an existing one. On first access, GoatDB automatically loads the source repository either from the local disk or by fetching it from the server. The hook triggers UI re-rendering whenever the query results are updated, regardless of whether the changes originate from local or remote edits.
When a query is first opened, it performs a linear scan of its source using a Coroutine without blocking the main thread. During and after this initial scan, the query caches its results to disk, allowing subsequent runs to resume execution from the cached state. For additional details, refer to the query mechanism documentation.
Type Parameters
| Type Parameter | Default type |
|---|---|
IS extends Schema | - |
CTX extends ReadonlyJSONValue | - |
OS extends Schema | IS |
Parameters
| Parameter | Type | Description |
|---|---|---|
config | UseQueryOpts<IS, CTX, OS> | Configuration of the desired query. |
Returns
Query<IS, OS, CTX>
A live Query instance.