Rejected
functionsignature
Rejected(reason): RejectionBuilds a Rejection for a reducer to return instead of state.
Parameters
| Name | Type | Description |
|---|---|---|
reason | string | Why the write is refused; surfaced verbatim to the caller. |
Returns
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}`)