reconnectEdge()
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
Parameters:Name | Type | Default |
---|---|---|
oldEdge | EdgeType The edge you want to update. | |
newConnection.source | string The id of the node this connection originates from. | |
newConnection.target | string The id of the node this connection terminates at. | |
newConnection.sourceHandle | string | null When not | |
newConnection.targetHandle | string | null When not | |
edges | EdgeType[] The array of all current edges. | |
options.shouldReplaceId | boolean Should the id of the old edge be replaced with the new connection id. | true |
Last updated on