🆕 New Features
Added useQuery
data mappers. Similar to subscriptions
, you can now pass a second argument to useQuery
to map the data and it will be fully typed.
const { data, error } = useQuery(
{
query: new TypedDocumentString<{ posts: Post[] }, never>(`
query Posts {
posts {
id
title
}
}
`),
},
({ data }) => {
return data?.posts.map(p => p.id) || [];
},
);
data.value;
//^ number[]