import { ConnectionState } from '@xyflow/system'; import type { InternalNode, Node } from '../types'; /** * 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). * * @public * @param connectionSelector - An optional selector function used to extract a slice of the * `ConnectionState` data. Using a selector can prevent component re-renders where data you don't * otherwise care about might change. If a selector is not provided, the entire `ConnectionState` * object is returned unchanged. * @example * * ```tsx *import { useConnection } from '@xyflow/react'; * *function App() { * const connection = useConnection(); * * return ( *