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.
useFetch
in Nuxt is a wrapper around$fetch
that handles SSR automatically.useQuery
does the same thing for SSR when plugin is properly set up.There are additional benefits of using
vue-query
when app runs in client side mode.But
useQuery
in itself does not fetch the data so it needs$fetch
or other Promise based function asqueryFn
.But you should not mix both. Choose one of them.