Skip to content

useFluxbaseQuery

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

Hook to execute a database query

Type ParameterDefault type
Tany
ParameterTypeDescription
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<T[], Error>

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