Skip to content

match

match<E, A, B>(cases): (data) => B

Defined in: Core/RemoteData.ts:200

Pattern matches on a RemoteData, returning the result of the matching case.

E

A

B

(e) => B

() => B

() => B

(a) => B

(data): B

RemoteData<E, A>

B

pipe(
  userData,
  RemoteData.match({
    notAsked: () => "Click to load",
    loading: () => "Loading...",
    failure: e => `Error: ${e}`,
    success: user => `Hello, ${user.name}!`
  })
);