Function useDerivedWaitable

A derived waitable is a waitable derived from zero or more other waitables and bindings. The value of a derived waitable is computed using the specified transformers.

The general usage pattern is something like:

const myWaitable = useDerivedWaitable(
{ someWaitable, someBinding },
[({ someWaitable, someBinding }) => someWaitable + someBinding, { ifLoading: () => 'loading' }],
{ id: 'myWaitable' }
);

An unnamed transformer is the same as { ifLoaded: … }

Named transformer meanings:

  • 'ifLoaded' - None of the waitables have undefined values
  • 'ifError' - At least one waitable has a defined error
  • 'ifLoading' - At least one waitable has an undefined value but no waitables have defined errors
  • 'ifErrorOrLoading' - At least one waitable has an undefined value or at least one waitable has a defined error
  • 'always' - Always applicable