Skip to Content
参考类型

OnNodesChange

这种类型用于为 onNodesChange 函数进行类型定义。

🌐 This type is used for typing the onNodesChange function.

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

字段

🌐 Fields

Parameters:
NameTypeDefault
changesNodeChange<NodeType>[]
Returns:
void

用法

🌐 Usage

这种类型接受自定义节点类型的泛型类型参数。有关更多信息,请参阅我们 TypeScript 指南中的本节

🌐 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], );
Last updated on