Skip to Content
You are viewing the v12 docs of React Flow. You can find the latest version here.
ReferenceTypes

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

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