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
Copy file name to clipboardExpand all lines: README.md
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ Features:
6
6
✅ Unopinionated
7
7
✅ 0 dependencies
8
8
✅ TypeScript ready
9
+
✅ Chained calls
9
10
✅ Allows programmatic refresh
10
11
11
12
## Installation
@@ -111,6 +112,27 @@ async (route, header) => {
111
112
112
113
-**initialValue**: the initial value for the **data** property. Defaults to undefined.
113
114
115
+
-**dependencies**: an array with dependencies on which the fetcher function depends on to be triggered. The array must only contain boolean values. The hook will wait until all values on the array are true before calling the fetcher function. It is useful in cases where you have to make sure of something before fetching the data, like veryfing an authentication token or chaining calls. Here is an example:
In the example above the request to **userDetails:/id** will only be made once the request to **users** has been fulfilled.
135
+
114
136
### Usage with other HTTP clients
115
137
116
138
By default, the hook uses the standard fetch API to request the data, but you can use any other client you want by passing your custom fetcher function:
@@ -139,7 +161,7 @@ export default UserList;
139
161
140
162
### Providing global options
141
163
142
-
It is also possible to provide global options so that every call to **useCachedFetch** will use them. You can do so by passing the **globalOptions** prop to **CachedFetchProvider**:
164
+
It is also possible to globally provide all available options so that every call to **useCachedFetch** will use them. You can do so by passing the **globalOptions** prop to **CachedFetchProvider**:
0 commit comments