Function useDerived

  • Accepts a val from anywhere and returns the latest derived value. Re-rendering is triggered when the derived value changes.

    Type Parameters

    • TSrcValue = any
    • TValue = any

    Parameters

    • val$: ReadonlyVal<TSrcValue>

      A val of value

    • transform: DerivedValTransform<TSrcValue, TValue>

      A pure function that takes an input value and returns a new value.

    • Optional eagerOrConfig: boolean | ValConfig<TValue>

      ValConfig of Val or just the eager. Default true.

    Returns TValue

    the derived value

  • Accepts a val from anywhere and returns the latest derived value. Re-rendering is triggered when the derived value changes.

    Type Parameters

    • TSrcValue = any
    • TValue = any

    Parameters

    • val$: undefined | ReadonlyVal<TSrcValue>

      A val of value

    • transform: DerivedValTransform<TSrcValue, TValue>

      A pure function that takes an input value and returns a new value.

    • Optional eagerOrConfig: boolean | ValConfig<TValue>

      ValConfig of Val or just the eager. Default true.

    Returns undefined | TValue

    the derived value, or undefined if val is undefined