Skip to Content
📣 We just released Svelte Flow 1.0 Alpha — try it out and give us your feedback!
ReferenceHooksuseConnection()

useConnection()

Source on GitHub 

The useConnection hook returns the current connection when there is an active connection interaction. If no connection interaction is active, it returns null for every property. A typical use case for this hook is to colorize handles based on a certain condition (e.g. if the connection is valid or not).

<script lang="ts"> import { useConnection } from '@xyflow/svelte'; const connection = useConnection(); </script>

Signature

Parameters:

This function does not accept any parameters.

Returns:

Current connection as a signal

NameType
currentConnectionState
Last updated on