Skip to content

useFluxbaseQuery

useFluxbaseQuery<T>(buildQuery, options?): UseQueryResult<NoInfer<T[]>, Error>

Hook to execute a database query

Type Parameter Default type
T any
Parameter Type Description
buildQuery (client) => QueryBuilder<T> Function that builds and returns the query
options? UseFluxbaseQueryOptions<T> React Query options IMPORTANT: You must provide a stable queryKey in options for proper caching. Without a custom queryKey, each render may create a new cache entry.

UseQueryResult<NoInfer<T[]>, Error>

// Always provide a queryKey for stable caching
useFluxbaseQuery(
(client) => client.from('users').select('*'),
{ queryKey: ['users', 'all'] }
)