T
TanStack3y ago
harsh-harlequin

Should you use useQuery to populate multiple filter dropdowns on a single page?

1. I have list data with multiple drop down filters. Some filters are independent, some are cascading(meaning dependent on some other filters selection) Does it make sense to use useQuery for fetching data for filters apart from the main listing api? 2. When I have multiple useQuery calls on the page(like the above example where there are api calls for dropdowns as well as main list), I want to alert user if any of the api call fails via a toaster alert with a dedicated message. What is a better way to handle errors in this case, if using onError callback is soon going to be deprecated. Do i write multiple useEffects?
1 Reply
fair-rose
fair-rose3y ago
1. yes 2. use the global onError handler (or a useEffect)

Did you find this page helpful?