💫
Promise Middleware
  • Introduction
  • Getting Started
    • Introduction
    • Design Principles
  • Guides
    • Catching Errors Thrown by Rejected Promises
    • Chaining Actions
    • Comparison to other promise middleware
    • Custom Type Delimiters
    • Custom Types
    • Optimistic Updates
    • Use with Async/Await
    • Use with Reducers
    • Use with Redux Actions
    • Use with Redux Promise Actions
    • Use with Promises Resolved with Null Values
  • Upgrade Guides
    • Upgrade from 5.x to 6.0.0
    • Upgrade from 4.x to 5.0.0
    • Upgrade from 3.x to 4.0.0
    • Release History
Powered by GitBook
On this page
  • Promise Objects Are State Machines
  • Action Objects Describe State Changes to the Store
  • Asynchronous Action Objects Describe the Promise Object State
  • Use Flux Standard Action (FSA)
  1. Getting Started

Design Principles

PreviousIntroductionNextCatching Errors Thrown by Rejected Promises

Last updated 7 years ago

Promise Objects Are State Machines

A promise object is a "machine" holding one of two states:

  1. Pending

  2. Settled

A settled state is the deffered result of the promise. This state will be either (a) rejected or (b) resolved. The rejected state throws an error and the fulfilled state returns either null or a value.

See more: .

Action Objects Describe State Changes to the Store

An action object describes changes to the store. Actions are the only source of information for the store.

See more: .

Asynchronous Action Objects Describe the Promise Object State

Promise middleware dispatches "asynchronous" action objects describing the state of the promise:

  1. Pending action

  2. Fullfilled or rejcted action (settled)

This affords asynchronous updates to the store.

Another way of thinking of this is promise middleware abstracts the two states of an promise object to two action objects.

Use Flux Standard Action (FSA)

Promise middleware dispatches actions in compliance with reccommendations.

ECMAScript 25.4 Spec: Promise Objects
Redux Documentation
the Flux Standard Action