File tree 3 files changed +77
-9
lines changed
3 files changed +77
-9
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,17 @@ This extension aims to accelerate development speed in projects that use React Q
21
21
22
22
Here you can see the available snippets for now.
23
23
24
- | Snippet | Content |
25
- | ------: | ------------------------------------------------------ |
26
- | ` uq ` | Generates ** useQuery** with API call |
27
- | ` um ` | Generates ** useMutation** with API call |
28
- | ` uiq ` | Generates ** useInfinteQueries** with API call |
29
- | ` uqp ` | Generates ** useQuery** with one parameter and API call |
30
- | ` upq ` | Generates ** usePaginatedQuery** with API call |
24
+ | Snippet | Content |
25
+ | ------: | ---------------------------------------------------------------------- |
26
+ | ` uq ` | Generates ** useQuery** with API call |
27
+ | ` um ` | Generates ** useMutation** with API call |
28
+ | ` uiq ` | Generates ** useInfinteQueries** with API call |
29
+ | ` uqp ` | Generates ** useQuery** with one parameter and API call |
30
+ | ` upq ` | Generates ** usePaginatedQuery** with API call |
31
+ | ` rqc ` | Generates a functional component with possible outcomes |
32
+ | ` rqct ` | Generates a functional component with possible outcomes (ternary) |
33
+ | ` rqs ` | Generates an if statement with status |
34
+ | ` iq ` | Generates ** queryCache.invalidateQueries** invalidateQueries statement |
31
35
32
36
## License
33
37
Original file line number Diff line number Diff line change 9
9
"categories" : [
10
10
" Snippets"
11
11
],
12
+ "icon" : " https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg" ,
12
13
"publisher" : " sayinserdar" ,
13
14
"contributes" : {
14
15
"snippets" : [
24
25
]
25
26
},
26
27
"repository" : " https://github.com/sayinserdar/react-query-snippet.git"
27
- }
28
+ }
Original file line number Diff line number Diff line change 86
86
" })"
87
87
],
88
88
"description" : " React Query - useInfiniteQuery - https://react-query.tanstack.com/docs/api#usepaginatedquery"
89
+ },
90
+ "React query Functional Component Result" : {
91
+ "prefix" : " rqc" ,
92
+ "body" : [
93
+ " " ,
94
+ " const ${1} = () => {" ,
95
+ " if (status === 'idle') {" ,
96
+ " return <span>Not ready... </span>;" ,
97
+ " }" ,
98
+ " " ,
99
+ " if (status === 'loading') {" ,
100
+ " return (<span>Loading... </span>);" ,
101
+ " }" ,
102
+ " if (status === 'error ') {" ,
103
+ " return (" ,
104
+ " <span>" ,
105
+ " Error:" ,
106
+ " {error.message}" ,
107
+ " </span>" ,
108
+ " );" ,
109
+ " }" ,
110
+ " " ,
111
+ " if (data) {" ,
112
+ " return (" ,
113
+ " <div>{data}</div>" ,
114
+ " );" ,
115
+ " }" ,
116
+ " return null;" ,
117
+ " };"
118
+ ],
119
+ "description" : " rqc"
120
+ },
121
+ "rqct" : {
122
+ "prefix" : " rqct" ,
123
+ "body" : [
124
+ " {status === 'idle' ? (" ,
125
+ " 'Not ready...'" ,
126
+ " ) : status === 'loading' ? (" ,
127
+ " <div>Loading...</div>" ,
128
+ " ) : isError ? (" ,
129
+ " <span>{error.message}</span>" ,
130
+ " ) : (" ,
131
+ " <div>{data}</div>" ,
132
+ " " ,
133
+ " )}"
134
+ ],
135
+ "description" : " rqct"
136
+ },
137
+ "rqs" : {
138
+ "prefix" : " rqs" ,
139
+ "body" : [
140
+ " if (status === 'idle') {" ,
141
+ " return <span>Not ready...</span>;" ,
142
+ " }"
143
+ ],
144
+ "description" : " rqs"
145
+ },
146
+ "iq" : {
147
+ "prefix" : " iq" ,
148
+ "body" : [
149
+ " queryCache.invalidateQueries([${1},{${2}: ${3}}])"
150
+ ],
151
+ "description" : " iq"
89
152
}
90
- }
153
+ }
You can’t perform that action at this time.
0 commit comments