27
27
<a href =" https://standardjs.com " >
28
28
<img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" />
29
29
</a >
30
- <a href =" https://www.youtube.com/channel/UCbQDX3YQJcQcISK_oyyYP6A " >
30
+ <a href =" https://www.youtube.com/playlist?list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW " >
31
31
<img src="https://img.shields.io/badge/youtube-subscribe-RED.svg" />
32
32
</a >
33
33
@@ -88,15 +88,15 @@ Usage
88
88
89
89
### Examples + Videos
90
90
91
- - useFetch - managed state, request, response, etc. [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-request-response-managed-state-ruyi3?file=/src/index.js ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=gtEwjpXbSik &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
92
- - useFetch - route, path, Provider, etc. [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-with-provider-c78w2 ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=33jqbLlQm3g &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
93
- - useFetch - request/response interceptors [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-provider-requestresponse-interceptors-s1lex ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=2xSQm_OYprc &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
94
- - useFetch - retries, retryOn, retryDelay [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-retryon-retrydelay-s74q9 ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=Y9zJwzR0vTg &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
95
- - useFetch - abort, timeout, onAbort, onTimeout [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=X9X9niivp-0 &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
96
- - useFetch - persist, cache [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=EWd3ekEypM8 &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
97
- - useFetch - cacheLife, cachePolicy [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=-8vq5VGMGnA &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
98
- - useFetch - suspense <sup >(experimental)</sup > [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-suspense-i22wv ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=MbWizFdJBoE &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i )
99
- - useFetch - pagination [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-provider-pagination-exttg ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=s-r6x1WrMns &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i &index=9 )
91
+ - useFetch - managed state, request, response, etc. [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-request-response-managed-state-ruyi3?file=/src/index.js ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=_-GujYZFCKI &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=6 )
92
+ - useFetch - route, path, Provider, etc. [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-with-provider-c78w2 ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=JWDL_AVOYT0 &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=10 )
93
+ - useFetch - request/response interceptors [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-provider-requestresponse-interceptors-s1lex ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=3HauoWh0Jts &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=8 )
94
+ - useFetch - retries, retryOn, retryDelay [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-retryon-retrydelay-s74q9 ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=grE3AX-Q9ss &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=9 )
95
+ - useFetch - abort, timeout, onAbort, onTimeout [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=7SuD3ZOfu7E &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=4 )
96
+ - useFetch - persist, cache [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=pJ22Rq9c8mw &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=7 )
97
+ - useFetch - cacheLife, cachePolicy [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=AsZ9hnWHCeg &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=3&t=0s )
98
+ - useFetch - suspense <sup >(experimental)</sup > [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-suspense-i22wv ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=7qWLJUpnxHI &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=2&t=0s )
99
+ - useFetch - pagination [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-provider-pagination-exttg ) [ ![ ] ( https://img.shields.io/badge/video-red.svg )] ( https://www.youtube.com/watch?v=YmcMjRpIYqU &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW &index=5 )
100
100
- useQuery - GraphQL [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/graphql-usequery-provider-uhdmj )
101
101
- useFetch - Next.js [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/s/usefetch-in-nextjs-nn9fm )
102
102
- useFetch - create-react-app [ ![ ] ( https://img.shields.io/badge/example-blue.svg )] ( https://codesandbox.io/embed/km04k9k9x5 )
@@ -143,7 +143,7 @@ function Todos() {
143
143
}
144
144
` ` `
145
145
146
- <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-request-response-managed-state-ruyi3?file=/src/index.js'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=gtEwjpXbSik &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
146
+ <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-request-response-managed-state-ruyi3?file=/src/index.js'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=_-GujYZFCKI &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=6 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
147
147
148
148
</details>
149
149
@@ -246,7 +246,7 @@ function App() {
246
246
}
247
247
` ` `
248
248
249
- <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-suspense-i22wv'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=MbWizFdJBoE &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
249
+ <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-suspense-i22wv'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=7qWLJUpnxHI &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=2&t=0s '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
250
250
251
251
</details>
252
252
@@ -353,7 +353,7 @@ const App = () => (
353
353
)
354
354
` ` `
355
355
356
- <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-provider-pagination-exttg?file=/src/index.js'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=s-r6x1WrMns &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i &index=9 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
356
+ <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-provider-pagination-exttg?file=/src/index.js'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=YmcMjRpIYqU &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW &index=5 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
357
357
358
358
359
359
</details>
@@ -423,7 +423,7 @@ var {
423
423
} = request
424
424
` ` `
425
425
426
- <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=gtEwjpXbSik &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
426
+ <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=_-GujYZFCKI &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=6 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
427
427
428
428
</details>
429
429
@@ -441,7 +441,7 @@ request.post('/todos', {
441
441
})
442
442
` ` `
443
443
444
- <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=33jqbLlQm3g &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
444
+ <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=JWDL_AVOYT0 &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=10 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
445
445
446
446
</details>
447
447
@@ -467,7 +467,7 @@ const searchGithubRepos = e => githubRepos.get(encodeURI(e.target.value))
467
467
< / >
468
468
` ` `
469
469
470
- <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=X9X9niivp-0 &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
470
+ <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=7SuD3ZOfu7E &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=4 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
471
471
472
472
</details>
473
473
@@ -673,7 +673,7 @@ function App() {
673
673
674
674
` ` `
675
675
676
- <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-provider-requestresponse-interceptors-s1lex'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=2xSQm_OYprc &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
676
+ <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-provider-requestresponse-interceptors-s1lex'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=3HauoWh0Jts &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=8 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
677
677
678
678
</details>
679
679
@@ -795,7 +795,7 @@ const TestRetry = () => {
795
795
retries: 1 ,
796
796
retryOn: [305 ],
797
797
// OR
798
- retryOn : ({ attempt, error, response }) => {
798
+ retryOn: async ({ attempt, error, response }) => {
799
799
// returns true or false to determine whether to retry
800
800
return error || response && response .status >= 300
801
801
},
@@ -819,7 +819,7 @@ const TestRetry = () => {
819
819
}
820
820
` ` `
821
821
822
- <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-retryon-retrydelay-s74q9'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=Y9zJwzR0vTg &list=PLZIwrWkE9rCfYafpuEkF6swOtiqRX5r9i '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
822
+ <a target="_blank" rel="noopener noreferrer" href='https://codesandbox.io/s/usefetch-retryon-retrydelay-s74q9'><img width='150px' height='30px' src='https://codesandbox.io/static/img/play-codesandbox.svg' /></a> <a target="_blank" rel="noopener noreferrer" href='https://www.youtube.com/watch?v=grE3AX-Q9ss &list=PLZIwrWkE9rCdUybd8t3tY-mUMvXkCdenW&index=9 '><img width='150px' height='30px' src='https://github.com/ava/use-http/raw/master/public/watch-youtube-video.png' /></a>
823
823
824
824
</details>
825
825
@@ -929,7 +929,7 @@ const options = {
929
929
// can retry on certain http status codes
930
930
retryOn: [503 ],
931
931
// OR
932
- retryOn ({ attempt, error, response }) {
932
+ async retryOn ({ attempt, error, response }) {
933
933
// retry on any network error, or 4xx or 5xx status codes
934
934
if (error !== null || response .status >= 400 ) {
935
935
console .log (` retrying, attempt number ${ attempt + 1 } ` );
@@ -986,6 +986,7 @@ If you have feature requests, [submit an issue][1] to let us know what you would
986
986
Todos
987
987
------
988
988
989
+ - [ ] ` persist` support for React Native
989
990
- [ ] better loading state management. When using only 1 useFetch in a component and we use
990
991
` Promise .all ([get (' /todos/1' ), get (' /todos/2' )])` then don't have a loading true,
991
992
loading false on each request. Just have loading true on 1st request, and loading false
0 commit comments