import type { RowType, UntypedTableDef } from '../lib/table.ts'; import type { Prettify } from '../lib/type_util.ts'; import { type Query } from '../lib/query.ts'; export interface UseTableCallbacks { onInsert?: (row: RowType) => void; onDelete?: (row: RowType) => void; onUpdate?: (oldRow: RowType, newRow: RowType) => void; /** Whether the subscription is active. Defaults to `true`. */ enabled?: boolean; } /** * React hook to subscribe to a table in SpacetimeDB and receive live updates. * * Accepts a query builder expression as the first argument: * - `tables.user` — subscribe to all rows * - `tables.user.where(r => r.online.eq(true))` — subscribe with a filter * * @param query - A query builder expression (table reference or filtered query). * @param callbacks - Optional callbacks for row insert, delete, and update events. * @returns A tuple of [rows, isReady]. * * @example * ```tsx * const [rows, isReady] = useTable(tables.user); * const [onlineUsers, isReady] = useTable( * tables.user.where(r => r.online.eq(true)), * { onInsert: (row) => console.log('New user:', row) } * ); * ``` */ export declare function useTable(query: Query, callbacks?: UseTableCallbacks>>): [readonly Prettify>[], boolean]; //# sourceMappingURL=useTable.d.ts.map