Skip to content

Commit 6773929

Browse files
committed
Add logo to manifest.json and add rqc,rqct,rqs,iq snippets
1 parent 80a3ad0 commit 6773929

File tree

3 files changed

+77
-9
lines changed

3 files changed

+77
-9
lines changed

README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ This extension aims to accelerate development speed in projects that use React Q
2121

2222
Here you can see the available snippets for now.
2323

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 |
3135

3236
## License
3337

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"categories": [
1010
"Snippets"
1111
],
12+
"icon": "https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg",
1213
"publisher": "sayinserdar",
1314
"contributes": {
1415
"snippets": [
@@ -24,4 +25,4 @@
2425
]
2526
},
2627
"repository": "https://github.com/sayinserdar/react-query-snippet.git"
27-
}
28+
}

snippets/snippets.code-snippets

+64-1
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,68 @@
8686
"})"
8787
],
8888
"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"
89152
}
90-
}
153+
}

0 commit comments

Comments
 (0)