Interface UseBindingArgs<GetType, ExtraFieldsT>

The post-initializer arguments that are passed to useBinding

interface UseBindingArgs<GetType, ExtraFieldsT> {
    addFields?: ((thisBinding: Binding<GetType>) => ExtraFieldsT);
    areEqual?: ((a: GetType, b: GetType) => boolean);
    deps?: DependencyList;
    detectChanges?: boolean;
    id: string;
    setValueTransformer?: SetValueTransformer<GetType>;
}

Type Parameters

Hierarchy (view full)

Properties

addFields?: ((thisBinding: Binding<GetType>) => ExtraFieldsT)

Use to support injecting additional fields into bindings

areEqual?: ((a: GetType, b: GetType) => boolean)

If specified, overrides the function used to compare values

_.isEqual, which can be globally overridden using setAreEqual

deps?: DependencyList

Hook dependencies

detectChanges?: boolean
  • If trueareEqual is used to compare the old and new values when set/setRaw are called. If the values are equal, the binding value won't be changed. If they're unequal, the binding value will be changed and listeners will be notified.
  • If false – old and new values aren't compared when set/setRaw are called. The binding will always be changed and listeners will always be notified.

false

id: string

A technical, but human-readable ID, which isn't guaranteed to be unique

setValueTransformer?: SetValueTransformer<GetType>

A transformer function called prior to storing the value when using the set method

The proposed new value

The binding being updated

The transformed value to set the binding to