Skip to content
Discussion options

You must be logged in to vote

The result of getNextPageParam will be injected into the queryFn as part of the queryContext, which is the first parameter to the queryFn. It's an object containing the queryKey as well as the pageParam property, which is the value you seek.

from the example in the docs:

  const fetchProjects = ({ pageParam = 0 }) =>
     fetch('/api/projects?cursor=' + pageParam)

so you need to change your `fetchPeople function accoringly:

- const fetchPeople = async (_, page = 1) => {
+ const fetchPeople = async ({ pageParam = 1 }) => {

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@aldryn-gutierrez
Comment options

@aldryn-gutierrez
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@aldryn-gutierrez
Comment options

Answer selected by aldryn-gutierrez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants