The createQueries hook can be used to fetch a variable number of queries at the same time using only one hook call.
The main use case for such a hook is to be able to fetch a number of queries, usually of the same type. For example if you fetch a list of todo ids, you can then map over them in a createQueries hook calling a byId endpoint that would fetch the details of each todo.
While fetching multiple types in a createQueries hook is possible,
there is not much of an advantage compared to using multiple createQuery calls
unless you use the suspense option as that createQueries can trigger suspense in parallel
while multiple createQuerycalls would waterfall.
The createQueries hook is the same as that of @tanstack/query useQueries. The only difference is that you pass in a function that returns an array of queries instead of an array of queries inside an object parameter.
When you're using the httpBatchLink or wsLink,
the below will end up being only 1 HTTP call to your server.
Additionally, if the underlying procedure is using something like Prisma's findUnique() it will
automatically batch& do exactly 1 database query as well.
You can also pass in any normal query options to the second parameter of any of the query calls in the array such as
enabled, suspense, refetchOnWindowFocus...etc.
For a complete overview of all the available options, see the tanstack useQuery documentation.
You can also pass in an optional Svelte Query context to override the default.
I don't think this is a real API.