Skip to content

TypeError: is not a function or its return value is not iterable #45

@MincePie

Description

@MincePie

At 9:17, this code:

const [{ data, fetching }] = usePostsQuery({
        variables,
      });

is causing an error:

TypeError: (0 , generated_graphql__WEBPACK_IMPORTED_MODULE_4_.usePostsQuery) is not a function or its return value is not iterable

The difference between Ben's updoot branch is that his generated/graphql has got an export as:

export function usePostsQuery(options: Omit<Urql.UseQueryArgs<PostsQueryVariables>, 'query'> = {}) {
  return Urql.useQuery<PostsQuery>({ query: PostsDocument, ...options });
};

Mine does not. I did run the generator successfully and my generated/graphql does include a Query for posts. It does not however have the above export function.

How do I look for the source of this problem? I'm trying to learn as much as I'm trying to solve this particular problem. Any advice for how to approach problem solving would be gratefully received. I thought the generated/graphql file was created by running yarn gen.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions