Skip to content

fold

fold<E, A, B>(onFailure, onNotAsked, onLoading, onSuccess): (data) => B

Defined in: Core/RemoteData.ts:153

Extracts the value from a RemoteData by providing handlers for all four cases.

E

A

B

(e) => B

() => B

() => B

(a) => B

(data) => B

pipe(
  userData,
  RemoteData.fold(
    e => `Error: ${e}`,
    () => "Not asked",
    () => "Loading...",
    value => `Got: ${value}`
  )
);