tanstack-db-skills-tanstack-db-live-queries
Installation
SKILL.md
Live Queries
TanStack DB live queries are reactive, type-safe queries that automatically update when underlying data changes. Built on differential dataflow, they update incrementally rather than re-running—achieving sub-millisecond performance even on 100k+ item collections.
Common Patterns
Basic Query with useLiveQuery
import { useLiveQuery, eq } from '@tanstack/react-db'
function TodoList() {
const { data: todos, isLoading } = useLiveQuery((q) =>
q
.from({ todo: todoCollection })
.where(({ todo }) => eq(todo.completed, false))
.orderBy(({ todo }) => todo.createdAt, 'desc'),
)