Skip to main content

useQuery()

function useQuery<T>(
query,
parameters,
options): QueryResult<T>

A hook to access the results of a watched query.

Type parameters

Type parameterValue
Tany

Parameters

ParameterTypeDefault value
querystring | CompilableQuery<T>undefined
parametersany[][]
optionsAdditionalOptionsundefined

Returns

QueryResult<T>

Example

export const Component = () => {
const { data: lists } = useQuery('SELECT * from lists');

return <View>
{lists.map((l) => (
<Text key={l.id}>{JSON.stringify(l)}</Text>
))}
</View>
}