Skip to Content
πŸ“£ We just released Svelte Flow 1.0 Alpha β€” try it out and give us your feedback!
ReferenceHooksuseNodeConnections()

useNodeConnections()

Source on GitHub 

This hook returns an array of connections on a specific node, handle type (β€˜source’, β€˜target’) or handle ID.

<script> import { useNodeConnections } from '@xyflow/svelte'; const connections = useNodeConnections({ handleType: 'target', handleId: 'my-handle' }); </script> <div>There are currently {connections.length} incoming connections!</div>

Signature

#Params
#id?
string
ID of the node, filled in automatically if used inside custom node
#handleType?
"source" | "target"
What type of handle connections do you want to observer?
#handleId?
string
ID of the handle
#onConnect?
(connections: Connection[]) => void
#onDisconnect?
(connections: Connection[]) => void
#Returns
Last updated on