Skip to Content

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 = (changes) => { edges = changes.applyTo(edges); };