-
I have an infiniteQuery, say like this, const queryNotifications = useInfiniteQuery('notifications', getNotifications, {
getNextPageParam: someFunction,
}); Then, I have another component, which use Is it possible? const queryClient = useQueryClient();
queryClient.fetchNextPage('notifications'); // Something like this How can I do fetchNextPage from this component? |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Mar 13, 2021
Replies: 1 comment 1 reply
-
I don’t think it’s possible with just the queryClient. You can either useInfiniteQuery in the second component as well, or take the function from the first component and make it available to the second one (as a prop or via context or so) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
afiiif
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don’t think it’s possible with just the queryClient. You can either useInfiniteQuery in the second component as well, or take the function from the first component and make it available to the second one (as a prop or via context or so)