Skip to content
Discussion options

You must be logged in to vote

Putting this here for an lost souls who stumble upon this in the future. For the first problem, where I was trying to call an external function inside the useQuery instead of

const {
    isLoading,
    isError,
    error,
    data: course,
  } = useQuery(["courses", id],  fetchCourseDetails(id), {
    staleTime: 60 * 60 * 1000,
  });

we do pass that function through an anonymous function like this

const {
    isLoading,
    isError,
    error,
    data: course,
  } = useQuery(["courses", id], () => fetchCourseDetails(id), {
    staleTime: 60 * 60 * 1000,
  });

For my second problem, where the url param was being queried twice, this was a Next.js problem. There is a long discussion about t…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@kowalski21
Comment options

@eigen-spaced
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@eigen-spaced
Comment options

@TkDodo
Comment options

@eigen-spaced
Comment options

@TkDodo
Comment options

@eigen-spaced
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by eigen-spaced
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants