import type { FetchQueryOptions } from 'react-query' ; import { queryClient } from './' ; example export function buildCachedRequest < R extends any , F extends ( ... args : any ) => Promise < R > > ( name , fn , options ? ) { return ( ( ... args ) => { return queryClient . fetchQuery ( [ name , JSON . stringify ( args ) ] , ( ) => fn ( ... args ) , options ) ; } ) as any ; }