Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

README.md

32 lines943 Bytes

1### Intro
2​
3The prerequisite for this code mod is to migrate your usages to the new syntax, so overloads for hooks and `QueryClient` methods shouldn't be available anymore.
4​
5### Affected usages
6​
7Please note, this code mod transforms usages only where the first argument is an object expression.
8​
9The following usage should be transformed by the code mod:
10​
11```ts
12const { data } = useQuery({
13 queryKey: ['posts'],
14 queryFn: queryFn,
15 keepPreviousData: true,
16})
17```
18​
19But the following usage won't be transformed by the code mod, because the first argument an identifier:
20​
21```ts
22const hookArgument = {
23 queryKey: ['posts'],
24 queryFn: queryFn,
25 keepPreviousData: true,
27const { data } = useQuery(hookArgument)
28```
29​
30### Troubleshooting
31​
32In case of any errors, feel free to reach us out via Discord or open an issue. If you open an issue, please provide a code snippet as well, because without a snippet we cannot find the bug in the code mod.