[RxJS 6] The Retry RxJs Error Handling Strategy
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[RxJS 6] The Retry RxJs Error Handling Strategy相关的知识,希望对你有一定的参考价值。
When we want to handle error observable in RxJS v6+, we can use ‘retryWhen‘ and ‘delayWhen‘:
const courses$: Observable<Counse[]> = http$ .pipe( tap(() => console.log("HTTP request")), map(res => Object.values(res[‘payload‘])), shareReplay(), // avoid using async pipe multi times causing multi network request retryWhen(errors => errors.pipe( delayWhen(() => timer(2000)) // wait 2s after the error observable happens )) )
以上是关于[RxJS 6] The Retry RxJs Error Handling Strategy的主要内容,如果未能解决你的问题,请参考以下文章
What is the difference between Reactjs and Rxjs?