import { type CompilableQuery } from '@powersync/common'; import { AdditionalOptions, DifferentialHookOptions, QueryResult, ReadonlyQueryResult } from './watch-types.js'; /** * A hook to access the results of a watched query. * @example * * export const Component = () => { * // The lists array here will be a new Array reference whenever a change to the * // lists table is made. * const { data: lists } = useQuery('SELECT * from lists'); * * return * {lists.map((l) => ( * {JSON.stringify(l)} * ))} * * } * * export const DiffComponent = () => { * // Providing a `rowComparator` results in the hook using an incremental query under the hood. * // An incremental query will only emit results when a change to the result set occurs. * // The internal array object references are maintained for unchanged rows. * // The returned lists array is read only when a `rowComparator` is provided. * const { data: lists } = useQuery('SELECT * from lists', [], { * rowComparator: { * keyBy: (item) => item.id, * compareBy: (item) => JSON.stringify(item) * } * }); * * return * {lists.map((l) => ( * {JSON.stringify(l)} * ))} * * } */ export declare function useQuery(query: string | CompilableQuery, parameters?: any[], options?: AdditionalOptions): QueryResult; export declare function useQuery(query: string | CompilableQuery, parameters?: any[], options?: DifferentialHookOptions): ReadonlyQueryResult;