Replies: 1 comment
-
You should always use composables at the top level of the <script setup>
const isMounted = ref(false)
const {
data,
error,
fetchNextPage,
hasNextPage,
isFetching,
isFetchingNextPage,
isPending,
isErro,
} = useInfiniteQuery({
queryKey: ['posts', perPage, refetch],
queryFn: ({ pageParam = page }) => fetchRepos({ pageParam, perPage, refetch }),
initialPageParam: 1,
getNextPageParam: (lastPage, pages) => lastPage.cursor,
enabled: isMounted
})
onMounted(() => isMounted.value = true)
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Nuxt: latest
I have follow the example to install the
vue-query
on NuxtI dont understand what I make wrong?... The
useInfiniteQuery
need to be inside thescript setup
tag? Can someone explain me why this happen?Beta Was this translation helpful? Give feedback.
All reactions