Skip to content

Commit efb77d7

Browse files
authored
docs(cancellation): add graphql request v4 example (#3264)
1 parent a536773 commit efb77d7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/src/pages/guides/query-cancellation.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ const query = useQuery('todos', ({ signal }) => {
9999
100100
## Using `graphql-request`
101101
102+
An `AbortSignal` can be set in the client `request` method.
103+
104+
```js
105+
const client = new GraphQLClient(endpoint)
106+
107+
const query = useQuery('todos', ({ signal }) => {
108+
client.request({ document: query, signal })
109+
})
110+
```
111+
112+
## Using `graphql-request` version less than v4.0.0
113+
102114
An `AbortSignal` can be set in the `GraphQLClient` constructor.
103115
104116
```js

0 commit comments

Comments
 (0)