NuxtN
Nuxt17mo ago
Sunny

How to organize query params in useFetch

I have an API with many parameters, so I am using useFetch('/api/myapi', { query: params }). The params is computed and returns all the necessary parameters to fetch the data. This works fine, but these parameters can also be changed from other components. How can I organize these parameters so that the API call automatically triggers when any of them change, but without making multiple API calls if two or more parameters are modified back-to-back? I want to avoid immediate API calls for every single change.
Was this page helpful?