PromiseState
The state shape that query atoms and injectPromise
use. This shape is based off React Query's queries.
Definition
interface PromiseState<T> {
data?: T
error?: Error
isError: boolean
isLoading: boolean
isSuccess: boolean
status: PromiseStatus
}
type PromiseStatus = 'error' | 'loading' | 'success'
The promise's resolved value when the promise completes. undefined
until then.
The promise's rejection value if the promise errors. undefined
until then.
A boolean. An alias for state.status === 'error'
. Is set to true if the promise rejects.
A boolean. An alias for state.status === 'loading'
. true
initially. Is set to false
when the promise is fulfilled (resolved or rejected).
A boolean. An alias for state.status === 'success'
. Is set to true when the promise resolves.
A string. One of 'error'
, 'loading'
, or 'success'
, reflecting the promise's current in-flight status.