Skip to content

Commit 8f54fb2

Browse files
author
rafamadriz
committed
added javascript snippets
1 parent 09a69d4 commit 8f54fb2

File tree

5 files changed

+1720
-0
lines changed

5 files changed

+1720
-0
lines changed

snippets/javascript/apollo.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"useQuery": {
3+
"prefix": "uq",
4+
"body": ["const { data, loading } = use${1:query}Query()"],
5+
"description": "useQuery"
6+
},
7+
"useQuery for component": {
8+
"prefix": "uqc",
9+
"body": ["const { data, loading } = use${TM_FILENAME_BASE}Query()"],
10+
"description": "useQuery that loads up data for current component"
11+
},
12+
"useMutation": {
13+
"prefix": "um",
14+
"body": [
15+
"const [${1:mutationName}, {loading}] = use${1:mutationName}Mutation()"
16+
],
17+
"description": "useMutation"
18+
},
19+
"useQuery with gql": {
20+
"prefix": "uqg",
21+
"body": ["const { data, loading } = useQuery(gql`${1:query}`)"],
22+
"description": "useQuery with raw mutation"
23+
},
24+
"useMutation with gql": {
25+
"prefix": "umg",
26+
"body": [
27+
"const ${1:mutationName} = useMutation(gql`${1:query}`, {",
28+
" variables: ${1:vars},",
29+
"});"
30+
],
31+
"description": "useMutation with raw query"
32+
}
33+
}

0 commit comments

Comments
 (0)