Skip to content

fold

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

Defined in: Core/RemoteData.ts:165

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

E

A

B

() => B

() => B

(e) => B

(a) => B

(data): B

RemoteData<E, A>

B

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