UseInfiniteQuery with a function that takes other parameters as well.
So i am trying to use useInfiniteQuery with a fetcher function that takes in some other parameters like search value and pageSize , and i am ending up using a ugly version of code which is the only thing typescript accepts. all other ways typescript is throwing errors. cannot get my way around it. if someone can show a better way to write this that will not cause a typescript error it would be really helpful.
Attaching the code for the hook as well as the fetcher function. Please do let me noe if there are grave errors if any. I have tried ai tools/google but no luck.
what irritates me the most is the way the query function is defined here , this is the only way that typescript is not giving errors. i noe there has to be a better way.
the below is the fetcher function
2 Replies
extended-salmon•14mo ago
you want
searchValue
to be part of the queryKeyadverse-sapphireOP•14mo ago
Got it thanks