Open
Description
Hey!
useQuery
hook accepts refetchOnMountOrArgChange
option. I find it very helpful when I need to refetch the data from the API after some time passed.
I'd like to achieve exact same results but with useLazyQuery
:
- There is a component rendered with button.
- When button is clicked - call
trigger
fromuseLazyQuery
. - When the button is clicked again within 5s - serve the data from cache
- When the button is clicked after 5s - make API request
Is it currently achievable? I tried many things but couldn't get it working like that with useLazyQuery
hook.
Thanks!