Skip to Content

useEdge(id: string)

Source on GitHub 

This hook returns the edge with the specified ID. When you subscribe, it will trigger whenever the edge changes. This happens when the edge is updated. The return value exposes a .current property to access the edge.

<script lang="ts"> import { useEdge } from '@xyflow/svelte'; const edge = useEdge('edge-id'); $inspect(edge.current); </script>

Signature

Parameters:
NameTypeDefault
idstring

The id of the edge to get

Returns:

The current edge inside a Svelte Flow context

NameType
currentEdgeType | undefined