Skip to content

Commit 814116b

Browse files
authored
Fixes axios example for cancelling request
Importing `CancelToken` imports type. The propose change matches [recent docs for cancellation of axios here](https://github.com/axios/axios#cancellation).
1 parent b95b865 commit 814116b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ But don't worry! If your queries are high-bandwidth or potentially very expensiv
1414
## Using `axios`
1515

1616
```js
17-
import { CancelToken } from 'axios'
17+
import axios from 'axios'
1818

1919
const query = useQuery('todos', () => {
2020
// Create a new CancelToken source for this request
21+
const CancelToken = axios.CancelToken
2122
const source = CancelToken.source()
2223

2324
const promise = axios.get('/todos', {

0 commit comments

Comments
 (0)