We are Coltor Apps ― a software development agency behind this OSS. Need a reliable tech partner?

Let’s talk

React API Reference

useAttributeValueUpdated

The useAttributeValueUpdated hook calls the provided callback whenever an attribute value changes on any entity in the given builder store.

Reference

useAttributeValueUpdated(builderStore, callback, comparator?)

import {
  useAttributeValueUpdated,
  useBuilderStore,
} from "@coltorapps/builder-react";

import { formBuilder } from "./form-builder";

export function App() {
  const builderStore = useBuilderStore(formBuilder);

  useAttributeValueUpdated(builderStore, (entity) => {
    console.log(`Attribute "${entity.updatedAttributeName}" updated`, entity);
  });

  return null;
}

Parameters

useAttributeValueUpdated accepts three parameters:

ParameterTypeDescription
builderStoreobjectThe builder store instance to monitor.
callbackfunctionA function called whenever any attribute value changes. Receives the updated entity and the updatedAttributeName.
comparatorfunction optionalOptional comparator used to detect attribute value changes. Defaults to the built-in shallow comparator.

Returns

This hook does not return a value. It registers a side effect that triggers the provided callback whenever any attribute on any entity is updated.

Previous
useEntityDeleted

Canary Branch