Skip to content

Instantly share code, notes, and snippets.

@ndreckshage
Created January 28, 2022 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndreckshage/24bc23511c8ad52e6b33603744ed11e1 to your computer and use it in GitHub Desktop.
Save ndreckshage/24bc23511c8ad52e6b33603744ed11e1 to your computer and use it in GitHub Desktop.
example-query
import { useQuery, gql } from "ui/lib/use-data.client";
const Component = () => {
const { data, hydrateClient } = useQuery<{
currentUser?: {
lists: {
id: string;
key: string;
title: string;
}[];
};
}>(
"currentUser::getLists",
gql`
query GetLists {
currentUser {
lists {
id
key
title
}
}
}
`
);
return (
<>
<div>
<p>{data.currentUser?.lists.length}</p>
</div>
{hydrateClient}
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment