Class State<Value>

State container that represents the asynchrony of a trackedFunction

Type Parameters

  • Value

Hierarchy

  • State

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    Type Parameters

    • Value

    Parameters

    • fn: ResourceFn<Value>
    • hooks: Hooks
    • Optional initialValue: Value

    Returns State<Value>

Properties

error?: unknown
isResolved: boolean = false
resolvedValue?: Value

Accessors

  • get isError(): boolean
  • Returns boolean

  • get isLoading(): boolean
  • Returns boolean

  • get isPending(): boolean
  • Returns boolean

  • get value(): null | NonNullable<Value>
  • Returns null | NonNullable<Value>

Methods

  • Will re-invoke the function passed to trackedFunction this will also re-set some properties on the State instance. This is the same State instance as before, as the State instance is tied to the fn passed to trackedFunction

    error or resolvedValue will remain as they were previously until this promise resolves, and then they'll be updated to the new values.

    Returns Promise<void>

Generated using TypeDoc