Import GraphQL Queries Where You Need Them (CRA)
If you want to export/import your GraphQL queries in your Create-React-App, you'll need to add a library to make it work. You can use a library called grapql.macro to use .gql
or .graphql
files in your app.
If you're also using jest, you'll need to add jest-transform-graphql and update your jest configuration to pick up these file types.
Source: https://www.apollographql.com/docs/react/integrations/webpack/#jest
Tweet