Rejected

function
store/rejection.ts:54
signature
Rejected(reason): Rejection

Builds a Rejection for a reducer to return instead of state.

Parameters

NameTypeDescription
reasonstringWhy the write is refused; surfaced verbatim to the caller.

Returns

Rejection

Example

example
reducer: (state, event) =>
  event.payload.expectedVersion === state.version
    ? { ...state, ...event.payload.patch, version: state.version + 1 }
    : Rejected(`stale write: expected v${event.payload.expectedVersion}, have v${state.version}`)