Extending react-query with typescript
Guys I'm just wondering if I can do something like this?
import { useQuery } from "@tanstack/react-query";
export function usePaginatedQuery (other params,...[USE QUERY PARAMS]) {
const query = useQuery([USE QUERY PARAMS])
}
I see myself rewriting the logic for this for the entire app so I'm trying to create a custom hook for it. However, I can't find any reference on the internet on how to properly extend useQuery using typescript. My knowledge in typescript is not that deep yet to figure out this kind of things. I know this is easy enough in plain js but I want the benefits of typescript. Any help would be appreciated, TIA!
import { useQuery } from "@tanstack/react-query";
export function usePaginatedQuery (other params,...[USE QUERY PARAMS]) {
const query = useQuery([USE QUERY PARAMS])
}
I see myself rewriting the logic for this for the entire app so I'm trying to create a custom hook for it. However, I can't find any reference on the internet on how to properly extend useQuery using typescript. My knowledge in typescript is not that deep yet to figure out this kind of things. I know this is easy enough in plain js but I want the benefits of typescript. Any help would be appreciated, TIA!
