💡 This is the legacy site for v11. If you are looking for the latest docs, please visit React Flow
Reference
updateEdge()

updateEdge()

Source on GitHub (opens in a new tab)

⚠️

This function is deprecated and will be removed in React Flow 12. Use reconnectEdge instead.

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 onEdgeUpdate = useCallback(
  (oldEdge: Edge, newConnection: Connection) => setEdges((els) => updateEdge(oldEdge, newConnection, els)),
  []
);

Signature

#Params
#edge
#connection
#edges
#options?
object
#options.shouldReplaceId
boolean
#Returns