ReactiveState

type ReactiveState<T> = 
  | {
  data: T | undefined;
  error: undefined;
  status: "retrying";
}
  | {
  data: T | undefined;
  error: unknown;
  status: "error";
}
  | {
  data: T;
  error: undefined;
  status: "loaded";
}
  | {
  data: undefined;
  error: undefined;
  status: "idle";
}
  | {
  data: undefined;
  error: undefined;
  status: "loading";
};

The lifecycle state of a ReactiveStreamStore as a single snapshot.

  • idle: the store has not yet been connected, or has been reset via `reset()`. Call `connect()` to open the underlying stream.
  • loading: a first connection is in progress; no data has arrived yet.
  • loaded: a value has been received and no error is active.
  • error: the stream failed. data holds the last known value (or undefined if none ever arrived) and error holds the failure.
  • retrying: a follow-up connect() is in progress after a previous outcome. error is cleared; data is preserved from the previous connection if any.

Type Parameters

Type Parameter
T

On this page