T
TanStack10mo ago
like-gold

useQuery optional arguments?

Hello folks, I can't find any information about how custom hook with useQuery handles optional arguments when sometimes like example i want to use useUsers() but also implementation like useUsers({params={id:100}, default: false}) would also work. So im wondering if i dont pass any args cache would work fine if default fallback value would be empty object {} or will it be unique cache every time cuz object would reference to new instance everytime hook is called. What would be best solution for this?
No description
1 Reply
metropolitan-bronze
metropolitan-bronze10mo ago
It looks fine to me: - without the params, it creates a cache entry under ['users'] - creates a cache entry for each set of params if there provides

Did you find this page helpful?