Skip to content

chain

chain<E, A, B>(f): (data) => RemoteData<E, B>

Defined in: Core/RemoteData.ts:122

Chains RemoteData computations. If the input is Success, passes the value to f. Otherwise, propagates the current state.

E

A

B

(a) => RemoteData<E, B>

(data): RemoteData<E, B>

RemoteData<E, A>

RemoteData<E, B>

pipe(
  RemoteData.of(5),
  RemoteData.chain(n => n > 0 ? RemoteData.of(n) : RemoteData.failure("negative"))
);