I liked the idea for key to use a function itself used for fetching the data because of no need to use strings or additional constants. Tried to use it from documentation and it triggers infinite rapid fetching. A function reference is stable (exported from separate module) so something inside custom hook needs to be memoized? Any guidance how to solve this?
I'm talking about this custom hook:
function useQuery(functionTuple, options) { const [queryFn] = Array.isArray(functionTuple) ? functionTuple : [functionTuple]; return useReactQuery(functionTuple, queryFn, options); }
I liked the idea for key to use a function itself used for fetching the data because of no need to use strings or additional constants. Tried to use it from documentation and it triggers infinite rapid fetching. A function reference is stable (exported from separate module) so something inside custom hook needs to be memoized? Any guidance how to solve this?
I'm talking about this custom hook:
function useQuery(functionTuple, options) { const [queryFn] = Array.isArray(functionTuple) ? functionTuple : [functionTuple]; return useReactQuery(functionTuple, queryFn, options); }