DEV Community

Discussion on: I Migrated Away from Apollo Client to Vercel SWR and Prisma graphql-request...and You Can Too!

Collapse
 
tettoffensive profile image
Stuart Tett

Where did you find out about this syntax:

const JOB_POST_BY_ID_QUERY = /* GraphQL */ `
  query paidJobPosts {
    jobPosts {
      id
    }
  }
`;

The examples in the graphql-request repo look like your apollo client version:

const query = /* GraphQL */ `
    query getMovie($title: String!) {
      Movie(title: $title) {
        releaseDate
        actors {
          name
        }
      }
    }`
Collapse
 
aryanjnyc profile image
Aryan J

Hi Stuart! The two are the same (GraphQL syntax is the same no matter which client you use.

The getMovie example requires a parameter (title) which is why you see it written like that.

Is that what you were talking about?

Collapse
 
tettoffensive profile image
Stuart Tett

If that is the case, then I think there is a mistake in your code in the article, because they do not match. Or I'm not understanding, because I expected the two examples to be compare/contrast of the different clients.

Thread Thread
 
aryanjnyc profile image
Aryan J

You're 100% right! As a compare/contract article, I should keep the code consistent. Thank you for pointing that out!