Skip to content

Commit

Permalink
Update GraphQL doc (#6898)
Browse files Browse the repository at this point in the history
* Need to install graphql package
* Need to provide real graphql in the .graphql file, not gql wrapped graphql
  • Loading branch information
nagman authored and amyrlam committed Apr 30, 2019
1 parent a2ae8a7 commit 4b8b38b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions docusaurus/docs/loading-graphql-files.md
Expand Up @@ -4,16 +4,16 @@ title: Loading .graphql Files
sidebar_label: Loading .graphql Files
---

To load `.gql` and `.graphql` files, first install the [`graphql.macro`](https://www.npmjs.com/package/graphql.macro) package by running:
To load `.gql` and `.graphql` files, first install the [`graphql`](https://www.npmjs.com/package/graphql) and [`graphql.macro`](https://www.npmjs.com/package/graphql.macro) packages by running:

```sh
npm install --save graphql.macro
npm install --save graphql graphql.macro
```

Alternatively you may use `yarn`:

```sh
yarn add graphql.macro
yarn add graphql graphql.macro
```

Then, whenever you want to load `.gql` or `.graphql` files, import the `loader` from the macro package:
Expand All @@ -27,13 +27,11 @@ const query = loader('./foo.graphql');
And your results get automatically inlined! This means that if the file above, `foo.graphql`, contains the following:

```graphql
gql`
query {
hello {
world
}
query {
hello {
world
}
`;
}
```

The previous example turns into:
Expand Down

0 comments on commit 4b8b38b

Please sign in to comment.