After generating the React Query hooks and functions, you can start using them in your React application.
Using the generated useQuery hooks
Optionally, you can also use the pure ts client in openapi/requests/services.gen.ts to customize your query.
Using the generated useQuerySuspense hooks
Using the generated useMutation hooks
Invalidating queries after a mutation is important to ensure the cache is updated with the new data. This is done by calling the queryClient.invalidateQueries function with the query key used by the query hook.
To ensure the query key is created the same way as the query hook, you can use the query key function exported by the generated query hooks.
Using the generated useInfiniteQuery hooks
This feature will generate a function in infiniteQueries.ts when the name specified by the pageParam option exists in the query parameters and the name specified by the nextPageParam option exists in the response.
The initialPageParam option can be specified to set the intial page to load, defaults to 1. The nextPageParam supports dot notation for nested values (i.e. meta.next).