useQuery + useFetch in Nuxt3 #7153
-
|
I'm using Vue-Query for first time, trying some experiments In Nuxt 3 I have a composable: Then in my page: And this works but in my console I have a warining:
Replacing useFetch with $fetch stills works and remove the warning but, why? I just to know why this behavior Note: My API is a nodejs API running in other project |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
But you should not mix both. Choose one of them. |
Beta Was this translation helpful? Give feedback.
useFetchin Nuxt is a wrapper around$fetchthat handles SSR automatically.useQuerydoes the same thing for SSR when plugin is properly set up.There are additional benefits of using
vue-querywhen app runs in client side mode.But
useQueryin itself does not fetch the data so it needs$fetchor other Promise based function asqueryFn.But you should not mix both. Choose one of them.