Created
January 28, 2022 07:41
-
-
Save ndreckshage/24bc23511c8ad52e6b33603744ed11e1 to your computer and use it in GitHub Desktop.
example-query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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