useQuery()
function useQuery<T>(
query,
parameters,
options): QueryResult<T>
A hook to access the results of a watched query.
Type parameters
Type parameter | Value |
---|---|
T | any |
Parameters
Parameter | Type | Default value |
---|---|---|
query | string | CompilableQuery <T > | undefined |
parameters | any [] | [] |
options | AdditionalOptions | undefined |
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>
}