OnNodesChange
此类型用于键入 onNodesChange
函数。
¥This type is used for typing the onNodesChange
function.
export type OnNodesChange<NodeType extends Node = Node> = (
changes: NodeChange<NodeType>[],
) => void;
字段
¥Fields
Parameters:Name | Type | Default |
---|---|---|
changes | NodeChange<NodeType>[] |
用法
¥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