ReferenceTypes

OnNodesChange

This type is used for typing the onNodesChange function.

export type OnNodesChange<NodeType extends Node = Node> = (
  changes: NodeChange<NodeType>[],
) => void;

Fields

#changes
NodeChange[]

Usage

This type accepts a generic type argument of custom nodes types. See this section in our Typescript guide for more information.

const onNodesChange: OnNodesChange = useCallback(
  (changes) => setNodes((nds) => applyNodeChanges(changes, nds)),
  [setNodes],
);