I have some queries with
import { gql } from '@apollo/client'; // from Apollo Client 3
and other with:
import gql from 'graphql-tag';
What's the difference between using one or another?
I had to change the one imported from apollo/client to graphql-tag because some problems with MockedProvider utility for testing from Apollo Client, but, why?
The first imports the helpers that the apollo client library rexports and the second imports the helpers directly. I'd use the first way, as it ensures you use the version that apollo client expects. The second one can give you a different version if you have
graphql-tag
as a direct dependency or another dependency requires it in a different version.