ReferenceUtils

reconnectEdge()

Source on GitHub

A handy utility to update an existing Edge with new properties. This searches your edge array for an edge with a matching id and updates its properties with the connection you provide.

const onReconnect = useCallback(
  (oldEdge: Edge, newConnection: Connection) => setEdges((els) => reconnectEdge(oldEdge, newConnection, els)),
  []
);

Signature

#Params
#edge
Edge
#connection
Connection
#edges
Edge[]
#options?
object
#options.shouldReplaceId
boolean
#Returns
Edge[]