useNodeChangedListener
useNodeChangedListener(
listener):void
React-friendly variant of addNodeChangedListener with automatic
cleanup on unmount. Preferred over the raw add / remove pair for
components and providers — the SDK does NOT clear the listener registry
on <WorkflowBuilder.Root> remounts, so manual cleanup is mandatory and
easy to forget.
The hook tolerates inline-arrow callbacks: a useRef trampoline keeps a
single stable subscription across re-renders while always invoking the
latest listener you passed. No need to wrap your callback in
useCallback.
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”void
Example
Section titled “Example”function MyProvider() { useNodeChangedListener((changes) => { console.log('changes', changes); }); return null;}