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

ParameterType
querystring | CompilableQuery<T>
parameters?any[]
options?AdditionalOptions

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>
}