0
votes

enter image description here

As you can see here, I used useQuery() but I only want it to fetch once. Not sure if it is NextJS problem or react-query problem.

1
please provide the code - tobzilla90

1 Answers

1
votes

Without code is hard to evaluate, but this works fines for me in NextJS. Probably the problem is where you're calling useQuery hook

function App (){
  const { loading, error, data: { listCourses: courses } = {} } = useQuery(
    listCourses(),
    {
      variables: { type: "online" },
    }
  );

  return (
    <Layout>
      {something}
    </Layout>
  );
};