Skip to content

Commit 5afb473

Browse files
authored
Update README.md
1 parent b98c19a commit 5afb473

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@ patch({
9393
})
9494
```
9595

96+
#### Coming Soon: `abort`
97+
98+
```jsx
99+
const { data, loading, request } = useFetch({
100+
baseUrl: `https://api.github.com/search`
101+
})
102+
103+
const searchGithub = e => request.get(`/repositories?q=${e.target.value || "''"}`)
104+
105+
<>
106+
<input onChange={searchGithub} />
107+
<button onClick={request.abort()}>Abort</button>
108+
{loading ? 'Loading...' : <code><pre>{data}</pre></code>}
109+
</>
110+
```
111+
96112
Hooks
97113
----
98114
| Option | Description |
@@ -144,5 +160,4 @@ Todos
144160
- [ ] Allow option to fetch on server instead of just having `loading` state
145161
- [ ] Allow option for callback for response.json() vs response.text()
146162
- [ ] add `timeout`
147-
- [ ] if 2nd param of `post` or one of the methods is a `string` treat it as query params
148163
- [ ] error handling if no url is passed

0 commit comments

Comments
 (0)