Skip to Content
React Flow 13 is here! Read the announcement →
ReferenceTypes

OnEdgesChange

This type is used for typing the onEdgesChange function.

export type OnEdgesChange<EdgeType extends Edge = Edge> = ( changes: EdgeChangeset<EdgeType>, ) => void;

Fields

Parameters:
NameTypeDefault
changesEdgeChangeset<EdgeType>
Returns:
void

Usage

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

onEdgesChange is now called with an EdgeChangeset instead of a plain EdgeChange[] array. Apply it with the changeset’s own applyTo() method:

const onEdgesChange: OnEdgesChange = useCallback( (changes) => setEdges((eds) => changes.applyTo(eds)), [setEdges], );