React Query: How to debounce queries
12 February 2023 (Updated 13 February 2023)
Hmm, actually this isn’t quite what we want. We also want to debounce the initial query. There’s another approach that I need to document here.
Keeping in mind that React Query will execute the query on initial load and then only when its query key changes, the idea is that you use a debounced version of your query keys. That way, the query itself will be debounced. See CodeSandbox for a working example.
Tagged:
React Query
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment