You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`timeout`| A customizable number of milliseconds measured before aborting the fetch call. |
21
+
22
+
## Requesting a fetch call with useFetch
23
+
24
+
`useFetch` is a simple function to grab data from a HTTP resource within the React web framework. To utilize `useFetch`, a URL is required. While `fetchOptions` isn't required, it is recommended to specify and customize the fetch call. Multipe `fetchOptions` can be used in one fetch call.
10
25
11
26
```jsx
12
27
importuseFetchfrom'@chrislaughlin/usefetch'
@@ -38,6 +53,8 @@ const Example = () => {
38
53
39
54
### Aborting a request via custom timeout
40
55
56
+
The `timeout` option can be used to abort a fetch call. `timeout` is measured in a customizable number of milliseconds that will trigger when fully counted.
57
+
41
58
```jsx
42
59
importuseFetchfrom'@chrislaughlin/usefetch'
43
60
@@ -64,6 +81,8 @@ const CustomTimeout = () => {
64
81
65
82
### Aborting a request via consuming application
66
83
84
+
With React, a fetch call can be aborted by consuming another application. This is performed by using the effect hook built natively in React.
85
+
67
86
```jsx
68
87
importuseFetchfrom'@chrislaughlin/usefetch'
69
88
@@ -98,3 +117,13 @@ const AbortExample = () => {
98
117
)
99
118
};
100
119
```
120
+
## Items returned from fetch calls
121
+
122
+
There are several items which may be returned when requesting a fetch call.
0 commit comments